I have the following SQL statement:
SELECT ID_TABLE_1
FROM TABLE_1
WHERE TABLE_1.STRING_FIELD=(
SELECT ANOTHER_STRING FROM ANOTHER_TABLE
WHERE ID_ANOTHER_TABLE = 1)
AND TABLE_1.FIELD_2= :PARAM
When I prepare the statement, everything is fine. But when I call getParameterMetaData(), an exception occurs:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
private static Pair<JDBCResources, Integer> execSQL(Connection conn, String sqlStatement, String params, boolean executeUpdate) {
try {
PreparedStatement ps = conn.prepareStatement(sqlStatement); //OK
ParameterMetaData paramData = ps.getParameterMetaData(); //java.sql.SQLSyntaxErrorException
The exception comes if I use Oracle Database 12.1.0.2 JDBC Driver -> ojdbc7.jar (3,698,857 bytes) It worked with the Java 6 JDBC driver -> ojdbc6.jar (1,988,051 bytes)
What's wrong in this SQL statement? Since I'm using Java 8, can I use the ojdbc7 driver even on Oracle Database X / XI?