views:

95

answers:

2

I am trying to cast a number, I think it is a double, to a decimal using the following:

CAST(syr_ep AS decimal(10,3)) As EP

which is still returning a double, so how do I achieve this?

A: 

DUMP will tell you what the datatype is

select cast(1 as binary_double) a, cast(1 as number(3,1)) b,
       dump(cast(1 as binary_double)) admp, dump(cast(1 as number(3,1))) bdmp       
from dual

But a simple DESC of the table which has the "syr_ep" column will tell you the datatype of the column. It is rare for a numeric value to be stored as a binary double in Oracle (partly because it is a relatively recent introduction).

Gary
A: 

Try this one

select round(125.315) from dual;

Result: 125
Bharat