stmt.getParameterMetaData().getParameterTypeName Not Working
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