Simple Java SQL Parser for Oracle??

From: Christian Eller <christian.eller_at_tugraz.at>
Date: Wed, 3 Mar 2004 21:42:45 +0100
Message-ID: <40464320$0$17706$3b214f66_at_aconews.univie.ac.at>



Hi,

does anyone know where I could get something like a minimal "SQL Parser", that can break up *.sql files into single sql statements (ignoring comments)?

For example following file:


insert into tmp_test (nr) values (18)
/
/* some comment starts here

insert into tmp_test (nr) values (19)
/

insert into tmp_test (nr) values (20)
/ */ -- and end here

insert into tmp_test (nr) values (21)
/

should result in 2 single statements (the first one and the last one)

Until now I split up the file by myself using the regular expressions "\\r?\\n\\s*/\\s*[\\r?\\n]" but this simple expression does not take into account comments and inline comments (like Oracle's "--")

A simple Java SQL Parser with Oracle Syntax would be perfect.

Thanks in advance for any help,
 Christian Received on Wed Mar 03 2004 - 21:42:45 CET

Original text of this message