Skip to content
Advertisement

ResultSetMetaData getScale returns 0

I have a table called RATE_HISTORY with a field called RATE.
The RATE field has scale 18.
I am using ResultsetMetaData to get meta-data of columns in this table on Oracle 11.2.
I execute the following query in my code:

JavaScript

When I do metadata.getScale(), it returns 0. However, if I execute this query:

JavaScript

getScale returns the correct value (18).
Is there a way to multiply two numbers in oracle and keep the scale?

Advertisement

Answer

Casting the result in the select should also work, the downside is that you have to repeat the scale from the column definition:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement