My Oracle Support Banner

ResultSetMetaData getScale(n) Returns -127 on SQL CASE Numeric Expression after database upgrade to version 12.2 and higher (Doc ID 2948197.1)

Last updated on AUGUST 09, 2023

Applies to:

JDBC - Version 12.1.0.1.0 and later
Information in this document applies to any platform.

Symptoms

After migrating the database from version 12.1 to 19c a JDBC application no longer works due to the ResultSetMetaData getScale calls returning the wrong value.
The ResultSetMetaData getScale call is used to obtain information on a column data type from the ResultSet of a query, in particular, on the precision of a NUMBER type.

Consider the following fragment of code

The CASE expression returns a numeric value.  The datatype of this expression does not have a defined precision.

With the database version 12.1.0.2 and lower, the getScale() returns 0.

Starting with database version 12.2.0.1 and including versions 19c and 21c  the getScale() returns -127.

This is true irrespective of the JDBC driver version and applicable to JDBC/thin and JDBC/OCI.

The JDBC driver has no say on what the getScale method returns, as this value is provided by the database.

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.