Use binary data type : Binary Data Type « Data Type « Oracle PL / SQL






Use binary data type

 


SQL> --TO_BINARY_DOUBLE(x): New for Oracle Database 10g. Converts x to a BINARY_DOUBLE.
SQL> CREATE TABLE float_point_demo
  2    (dec_num    NUMBER(10,2),
  3     bin_double BINARY_DOUBLE,
  4     bin_float  BINARY_FLOAT);

Table created.

SQL>
SQL> INSERT INTO float_point_demo VALUES (1234.56,1234.56,1234.56);

1 row created.

SQL>
SQL> SELECT * FROM float_point_demo;

   DEC_NUM BIN_DOUBLE  BIN_FLOAT
---------- ---------- ----------
   1234.56 1.235E+003 1.235E+003

SQL>
SQL> SELECT DUMP(dec_num) "Decimal",
  2     DUMP(bin_double) "Double"
  3     FROM float_point_demo;

Decimal
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Double
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Typ=2 Len=4: 194,13,35,57
Typ=101 Len=8: 192,147,74,61,112,163,215,10


SQL>
SQL>
SQL>
SQL> drop table float_point_demo;

Table dropped.

SQL>
SQL>
SQL>
           
         
  








Related examples in the same category

1.BINARY_INTEGER assignment
2.BINARY_INTEGER as loop counter
3.BINARY_FLOAT and BINARY_DOUBLE example
4.BINARY_FLOAT_INFINITY, BINARY_DOUBLE_INFINITY