Question

My database table contains one column of varchar2(20,10), but since it is a total amount field I need currency data type. (If I enter 1235.5 it should take it as 1235.50.)

I tried changing to type number(20,2), I am not able to do this with number(20,2) in Oracle 10g.

Was it helpful?

Solution

I guess you need not bother about insert, as long you have a precision of atleast 2. When you are fetching using select query, try using the select query as :

Select to_char(1234.4, 'fm9999999.00') from dual; 
Select to_char(1234.45, 'fm9999999.00') from dual; 
Select to_char(1234,'fm9999999.00') from dual;
Select to_char(1234.4567, 'fm9999999.00') from dual;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top