Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I escape double quotes in a prepared statement in a java stored proc

606026Dec 18 2007 — edited Dec 20 2007
It looks like the XMLElement is pretty touchy about it's first argument being in double quotes. This of course won't work:

String sql = "select XMLElement("CERT_CODE", cert_code)"+
" from cert_table"+
" where user_id='18592'";
PreparedStatement pstmt = conn.prepareStatement(sql);

""CERT_CODE"" wont compile: ORA-29536: badly formed source: Encountered "\"CERT_CODE\""

/"CERT_CODE/" wont compile: ORA-29536: badly formed source: Encountered "CERT_CODE"

' ' CERT_CODE' ' compiles, but runtime: OracleSQLException: ORA-00931: missing identifier

I've tried every other syntax I can think of and they all return the same.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2008
Added on Dec 18 2007
2 comments
5,730 views