Oracle JDBC (MOSC)

MOSC Banner

stmt.getParameterMetaData().getParameterTypeName Not Working

in Oracle JDBC (MOSC) 1 commentAnswered ✓

We have to do some pre-processing like changing the date field format before the query is executed on the DB by the JDBC driver.

 

To achieve that we used the PreparedStatement.getParameteMetaData(), we found that for simple query we can see the metadata, but for queries having cast functions, BETWEEN, JOINs the metadata returned is null.

 

For example :

   PreparedStatement stmt = conn.prepareStatement(“SELECT MAX(OBJECTID) FROM TEST_CHAR WHERE STATUSCODE = ? AND LABELKEY BETWEEN ? AND ? ”);

  ParameterMetaData metadata = stmt.getParameterMetaData().getParameterTypeName(1);     // returns null


  PreparedStatement stmt = conn.prepareStatement(“SELECT MAX(OBJECTID) FROM TEST_CHAR WHERE STATUSCODE = ? AND LABELKEY = TO_CHAR(?) ”);

  ParameterMetaData metadata = stmt.getParameterMetaData().getParameterTypeName(1);     // returns null

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