Skip to content Skip to sidebar Skip to footer

Sqlsyntaxerrorexception When Using Like With Ojdbc7.jar

I have the following statement : PreparedStatement prpStat = conn .prepareStatement('SELECT * FROM natperson WHERE name LIKE ?'); prpStat.setString

Solution 1:

An Oracle Bug addresses the issue where the LIKE operator causes a problem in the parser: Bug 18590786

This bug was also referenced in a similar Oracle Bug: Bug 18644587 : ORACLEPARAMETERMETADATAPARSER GENERATES BAD STATEMENT FOR A UNION

It is not clear whether the fix is generally available yet.

Solution 2:

Maybe a little too late, but a workaround to this is to qualify the field before the LIKE with double quotes like below:

SELECT*FROM natperson WHERE "NAME" LIKE ?

Post a Comment for "Sqlsyntaxerrorexception When Using Like With Ojdbc7.jar"