Solved

How to parse a PL/SQL string into XML?

Posted on 2001-08-01
5
272 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
5 Comments
 
LVL 1

Accepted Solution

by:
lawrie earned 50 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

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 This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

803 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