[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to parse a PL/SQL string into XML?

Posted on 2001-08-01
5
Medium Priority
?
285 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:ThomasLi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
lawrie earned 200 total points
ID: 6341323
Assumeing I understand your question correctly, I would suggest using JavaCC, which is a parser generator, and quite powerful. (Antlr is another Java based parser generator, but I don't know enough about that one)

You can get it freely at http://www.webgain.com/products/metamata/java_doc.html

A grammar for PL/SQL can be found at http://www.cobase.cs.ucla.edu/pub/javacc/

Hope this helps
0
 

Author Comment

by:ThomasLi
ID: 6342325
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?
0
 
LVL 3

Expert Comment

by:graf27
ID: 6343489
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.
0
 

Author Comment

by:ThomasLi
ID: 6344507
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.
0
 
LVL 5

Expert Comment

by:lwinkenb
ID: 8895272
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
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question