I had a query running for some time (mounted by JPA) when suddenly I was given an exception:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n / a]; SQL state [99999]; error code [29902]; could not extract ResultSet; nested exception is org.hibernate.exception.GenericJDBCException: could not extract ResultSet at org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:973)
In summary, it gives me SQL state [99999]; error code [29902]; which is a problem in the parameters.
The query that is mounted (roughly) and that gives problems is this:
select * from mytabla where CONTAINS(campo1, 'BT');
After a bit of google-fu I discovered that BT is a query operator of the contains and, as in that case, it does not have the parameters it should, because it gives the pete.
This error can be reproduced by looking for NOT
, DIFMERGE
, ABOUT
, AND
.. and many others that come in that link.
Question :
Is there any way to " escape " the word BT
(or any function of those), so that oracle is thought to be a word and not a function?
The contains I put it like this:
return builder.greaterThan(
builder.function("CONTAINS", Integer.class, exp, builder.literal(((String) param.getValue()).toUpperCase())),
0);
EDIT: For trying something I tried to code the word BT in unicode, but it does not work either, it gives the same error.
select * from myTable WHERE CONTAINS (field1, UNISTR ('\ 0042 \ 0054')) > 0