Link to home
Start Free TrialLog in
Avatar of ThomasLi
ThomasLi

asked on

How to parse a PL/SQL string into XML?

Can anybody tell me how to parse a PL/SQL statement in String into an XML object in Java?

Current I need to develop a GUI for PL/SQL syntax checking in my Java application before sending SQL to Oracle database engine.


Thanks in advance.

Thomas
ASKER CERTIFIED SOLUTION
Avatar of lawrie
lawrie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ThomasLi
ThomasLi

ASKER

I have seen that Oracle.xml.query.OracleXMLQuery class has a constructor which accepts a JDBC connection and a String query, I wonder to know when the connection is used? Can I use a null? How to pull back the string query in XML object?
With OracleXMLQuery, you get any ResultSet as XML-String ! You cannot use a null as connection. You cannot pull back the string query in XML-Object, you get the Result of the Query as XML-String. I dont know how important it is in your application to do a own syntax-check programmatically. Let do the hard work your database. Send any statement to the database. If the statement is wrong or any other errors occur, you get ther right error-messages.
The problem is that I got some nonstandard queries for non-Oracle databases mixed with Oracle SQL in distributed query, I have to parse the query and dispatch subqueries into the right database engines. But I don't want to write a parser because it too time consuming. Anyway, if I can't pull out the parser from Oracle, I will use JavaCC, the parser generation tools, to generate one.



Thank you all for responses.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept comment by Lawrie as answer.
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lwinkenb
EE Cleanup Volunteer