SQL Language (MOSC)

MOSC Banner

DB2 SQL to Oracle SQL change

edited Jul 30, 2022 1:40PM in SQL Language (MOSC) 3 commentsAnswered

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??


Thanks

Sobek77

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center