Extracting the digits after decimal from a float number [message #1120] |
Tue, 02 April 2002 19:28 |
Rajeev Katyal
Messages: 55 Registered: April 2002
|
Member |
|
|
Suppose i have following data in my table
marks
-----
100.0056
20.0007
21.8989
what i want is to , extract 0056(infact 56) from first row, 7 from second row and 8989 from 3rd row.
how to go about it.
what funcion can be used
or only substr or instr() funtions can be used for above.
|
|
|
|
|
Re: Extracting the digits after decimal from a float number [message #1133 is a reply to message #1120] |
Wed, 03 April 2002 09:41 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Just for kicks, here's another way not using instr or substring:
sql>select c, to_number(replace(to_char(c - trunc(c)), '.')) dec
2 from t;
C DEC
--------- ---------
21.8989 8989
20.0007 7
100.0056 56
I wasn't sure if you needed the to_number conversion, but I threw it in there anyway...
|
|
|
|