views:

98

answers:

1

Hi

I am trying to doing some SQL queries out of Oracle 11g and am having issues using ora:contains. I am using Spring's JDBC implementation and my code generates the sql statement:

select * 
  from view_name 
 where column_a = ? 
   and column_b = ? 
   and existsNode(xmltype(clob_column), 
                  'record/name [ora:contains(text(), "name1") > 0]', 
                  'xmlns:ora="http://xmlns.oralce.com/xdb"') = 1

I have removed the actual view / column names obviously, but when I copy that into sqlplus and substitute in random values, the select executes properly. When I try to run it in my DAO code I get this stack trace:

org.springframework.jdbc.UncatergorizedSQLException: PreparedStatementCallback;
uncatergorizedSQLException for SQL [the big select above]; SQL state [99999]; 
error code [31011]; 
ORA-31011: XML parsing failed.
ORA-19202: Error occured in XML processing
LPX-00607: Invalid reference: 'contains';nested exception is java.sql.SQLException: 
ORA-31011: XML parsing failed
ORA-19202: Error occured in XML processing
LPX-00607: Invalid reference: 'contains'

(continues on like this for awhile....)

I think it is worth mentioning that I am using Maven and it is possible I am missing some dependency that is required for this. Sorry the post is so long, but I wanted to err on the side of too much info.

Thanks for taking the time to read this at least =)

-Windle

+1  A: 

You appear to have a spelling mistake in your namespace declaration:

'xmlns:ora="http://xmlns.oralce.com/xdb"'
                            ^^

If that really is a typo in your code (rather than just in your posting here) it can't hurt to fix it.

APC
I will verify it when I get into work tomorrow, but I think you might have found the problem. The code is on a standalone network so I had to print it out and retype it, but I found my printed version and it has the same typo. Hopefully that is the only problem.
Windle
That was it. I guess sqlplus already knows about the ora namespace and doesn't even look it up. Thanks APC
Windle