select case when country='USA' then to_number(value,10,3) else to_number(Value,10,2) from emp_country;
Table Creation:
create table emp_country ( PersonID int, Country varchar(25), Value number(30,5) );
current output:
personid country value
12 USA 123.45
13 INR 125.09
14 USA 234.09
15 UK 123.45
Expected output:
personid country value
12 USA 12.345
13 INR 125.09
14 USA 23.409
15 UK 123.45
TO_char is not working and getting error like ORA-01722: invalid number , getting the error