Reputation: 5904
how can i convert a integer to decimal in oracle? Is there any function like TO_CHAR? I need to put this function on a where clause. Thanks
SELECT IDDS,
ID
FROM T_TABLEONE
WHERE CAST(ID as DECIMAL)='1,301131832E19';
Upvotes: 1
Views: 36905
Reputation: 52346
If you apply a function to the column then you can run the risks of:
So it's generally a bad practice, and you'd do better to cast your literal to the same type as the column, in this case using to_number().
However in this case I'm surprised that it's necessary, as Oracle's type conversion in recent releases should be able to cope with comparing an integer column to a number expressed in scientific notation: http://sqlfiddle.com/#!4/336d3/8
Upvotes: 1