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!

Number incorrectly formatted when applying the To_Char function.

Andrew HoldenJun 8 2025

I am retrieving data from an Oracle 19C Enterprise Edition Database and inserting the data into a staging table held in an Oracle 12C Enterprise Edition Database.

The data is inserted into the staging table without issues, but when querying the staging table and applying the TO_CHAR function to the Nominal column (of type NUMERIC(22,7)), rounding discrepancies occur.

e.g. 2558587897.3899989 is returned as 2558587897.3899999 using TO_CHAR(Nominal, ‘FM999999999999999,9999999’)

Using the TO_CHAR function after removing a few digits from the integer part of the number returns the correct value.

Why does the TO_CHAR function have issues formatting the number 2558587897.3899989?

Comments
Post Details
Added on Jun 8 2025
4 comments
304 views