0

I am using dbutils QueryRunner on a product table to get (ID, Name) from the table where the query is as follows:

select ID, NAME
from PRODUCT
where NAME LIKE ?
LIMIT 5;

I am getting

ERROR 203 (22005): Type mismatch. BOOLEAN for null Query

while if i run the same query with NAME = ? , it works fine.

Can you please let me know what is wrong with the syntax and also how can i use the escape sequence for e.g

WHERE NAME LIKE 'XYZ%'

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
Mouzzam Hussain
  • 449
  • 3
  • 8
  • 20
  • SQL usually requires `LIKE` followed by a string in single quotes. Does your example of `WHERE NAME LIKE 'XYZ%'` work? If so, what else are you asking? – SlimsGhost Jul 12 '16 at 14:41
  • `List> results = new QueryRunner(getDataSource()).query( Query, new MapListHandler(), "'"+productName+"%'");` that is how i am calling my function when i get the error; No the example dosent work! – Mouzzam Hussain Jul 12 '16 at 14:47
  • 1
    There is no unified SQL parser in JDBC. How your SQL statement is parsed and where and how `?` works is up to the particular driver and/or database. To my experience, inexplicable limitations are the norm… – Holger Jul 12 '16 at 15:04

0 Answers0