2

I have the below SQL query:

SELECT
    ORDER_ID,
    ORDER_CODE
FROM
    ORDERS
WHERE
    (ORDER_ID,SEQUENCE) in ((?,?))

PreparedStatement statement = connection.prepareStatement(sql)

The above line of code produces a PreparedStatement object successfully in Oracle with the above query but in Apache Derby, it is throwing the following exception:

java.sql.SQLSyntaxErrorException: Syntax error: Encountered "," at line 8, column 14.

Could someone please explain how to query multiple columns in IN clause in DERBY.

Reference post:
http://apache-database.10148.n7.nabble.com/Using-IN-clause-with-multiple-columns-td98558.html

Thank you!

Abra
  • 19,142
  • 7
  • 29
  • 41
ht_3535
  • 363
  • 3
  • 9

1 Answers1

2

Conclusion: Derby does not support the multiple IN clause for prepared statement. (?,?) -- this syntax would throw an error.

Moving to H2 database for tests is better since it is possible to do there and more powerful.

ht_3535
  • 363
  • 3
  • 9