My Oracle Support Banner

CHAR Datatype Returned Instead Of VARCHAR2 With Oracle Database 12.1.0.2 And JDBC (Doc ID 2000440.1)

Last updated on OCTOBER 31, 2022

Applies to:

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

Symptoms

Java programs running on Oracle Database 12.1.0.2 on AIX platform show resultset Metadata getColumnType giving CHAR instead of VARCHAR2.
The problem occurs when querying a table with a GROUP BY clause on a VARCHAR2 column and a WHERE clause with a constant variable like the query shown below:

<COLUMN_NAME1> is defined as VARCHAR2 in table <TABLE_NAME>. However, JDBC reports the type as CHAR instead of VARCHAR2.

=> With database 10g and JDBC, when querying a table with a GROUP BY clause on a VARCHAR2 column and a WHERE clause with a constant variable : the datatype returned is VARCHAR2.
=> With database 12.1.0.2 and JDBC, when querying a table with a GROUP BY clause on a VARCHAR2 column and a WHERE clause with a constant variable : the datatype returned is CHAR and not VARCHAR2 as it should be.


Independently of the JDBC version, the problem only reproduces against 12.1.0.2 database.  All other database versions lower than 12.1.0.2 do not show the problem.

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.