views:

85

answers:

2

Hi. Currently I'm making sort of SQL command line interface for web-based application. It should act roughly like sqlPlus. I have encountered a problem how to execute sql's. They can be both as SQL and/or PL/SQL.

First way I thought that I can split them (by ';' or ';/') and detect separately if it's sql select or delete/update/insert or pl/sql.

Now I cant find for PL/SQL Backus–Naur Form to make regexp. May be there exists easier way?

Generally, What is the best way to make such logic ?

TIA

+2  A: 

I think the best way is to use ANTLR which have a PLSQL grammar. You can generate code for java and other languages.

FerranB
+1  A: 

I have a similar problem and I simply pass my SQL or PL/SQL code to SQL*Plus on the server...

Olof