[antlr-interest] Newbie needs guidance on parsing SQL

Terence Parr parrt at cs.usfca.edu
Wed Sep 20 11:16:27 PDT 2006


On Sep 20, 2006, at 9:53 AM, WALTERS, CRAIG P [AG/1000] wrote:

>
> I am doing my 1st antlr project (version 2.7.6).  I downloaded  
> DmlSQL2/SQL2
> and converted them from C++ to Java.  What I need to do is scan a  
> string
> containing (Oracle) SQL DML and extract all of the names of the  
> tables that
> are the targets of modifications (INSERT, UPDATE, DELETE,  
> TRUNCATE).  I
> can't figure out how to get the table names.  Can someone give me some
> suggestions?

Hi. Write the grammar for the subset and then put in an action that  
references the IDENTIFIER matched for table name.  Use the text for  
that ID as you wish.

Ter



More information about the antlr-interest mailing list