Hi,
With MaxDB 7.6 this code and query executed fine:
PreparedStatement prst = connection.prepareStatement("select 1 from dual where 'TRUE' = ?"); | |
prst.setString(1, "FALSE"); | |
prst.execute(); |
However, after switching to MaxDB 7.8, it fails with the following exception:
com.sap.dbtech.jdbc.exceptions.DataTruncation: Value of parameter 1 is too large. Parameter length was 10 but maximum size is 8.
at com.sap.dbtech.jdbc.exceptions.DataTruncation.createDataTruncationException(DataTruncation.java:42)
at com.sap.dbtech.jdbc.translators.DBTechTranslator.checkFieldLimits(DBTechTranslator.java:1342)
at com.sap.dbtech.jdbc.translators.UnicodeStringTranslator.transStringForInput(UnicodeStringTranslator.java:99)
at com.sap.dbtech.jdbc.CallableStatementSapDB.setString(CallableStatementSapDB.java:2232)
at com.sap.dbtech.jdbc.trace.PreparedStatement.setString(PreparedStatement.java:480)
It happens because the parameter length ("FALSE") is longer than left-hand operand ("TRUE"). Is there any setting in MaxDB 7.8 that would make this query work again?
I know the query can be fixed by exchanging the parameter and string literal in the query (eg. "... where ? = 'TRUE' "), but the existing code has so many queries that it not easily doable.
Regards,
AD