Database Reference
In-Depth Information
numbers in the BINARY_FLOAT and BINARY_DOUBLE types. As a quick example, we can create a table with the various
datatypes in them and see what is stored given the same inputs:
EODA@ORA12CR1> create table t
2 ( num_col number,
3 float_col binary_float,
4 dbl_col binary_double
5 )
6 /
Table created.
EODA@ORA12CR1> insert into t ( num_col, float_col, dbl_col )
2 values ( 1234567890.0987654321,
3 1234567890.0987654321,
4 1234567890.0987654321 );
1 row created.
EODA@ORA12CR1> set numformat 99999999999.99999999999
EODA@ORA12CR1> select * from t;
NUM_COL FLOAT_COL DBL_COL
------------------------ ------------------------ ------------------------
1234567890.09876543210 1234567940.00000000000 1234567890.09876540000
Note that the NUM_COL returns the exact number we provided as input. There are fewer than 38 significant digits
in the input number (I supplied a number with 20 significant digits), so the exact number is preserved. The FLOAT_COL ,
however, using the BINARY_FLOAT type, was not able to accurately represent this number. In fact, it preserved only
7 digits accurately. The DBL_COL fared much better, accurately representing the number in this case out to 17 digits.
Overall, though, this should be a good indication that the BINARY_FLOAT and BINARY_DOUBLE types will not be
appropriate for financial applications! If you play around with different values, you'll see different results:
EODA@ORA12CR1> delete from t;
1 row deleted.
EODA@ORA12CR1> insert into t ( num_col, float_col, dbl_col )
2 values ( 9999999999.9999999999,
3 9999999999.9999999999,
4 9999999999.9999999999 );
1 row created.
EODA@ORA12CR1> select * from t;
NUM_COL FLOAT_COL DBL_COL
------------------------ ------------------------ ------------------------
9999999999.99999999990 10000000000.00000000000 10000000000.00000000000
 
Search WWH ::




Custom Search