Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DB2 SQL to Oracle SQL change

User_49B97Jul 30 2022

Can someone please confirm syntax db2 vs oracle just want to make sure it's correct
I don't know db2 syntax that well (or not much at all) additionally, I don't have ability to check db2 syntax.
DB2 syntax:
SELECT DECIMAL(123245632134.1234567 ,15, 3) FROM TABLE;
retuns (I think)
123245632134.123 <-- NUMBER

Oracle syntax:
SELECT TO_NUMBER(TO_CHAR(123245632134.1234567,'999999999999.999')) FROM TABLE;
returns
123245632134.123 <-- NUMBER
Oracle syntax return number correctly however for me this looks weird, is there any other shorter way to present DB2 decimal function Decimal(num,15, 3) in Oracle SQL??

Comments
Post Details
Added on Jul 30 2022
3 comments
661 views