Parsing SQL Statement

  • From: Deepak Sharma <sharmakdeep_oracle@xxxxxxxxx>
  • To: Oracle-L@xxxxxxxxxxxxx, oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 21 Mar 2007 08:27:52 -0700 (PDT)

Is there an easy way to extract the different parts of an SQL statement 
(SELECT, FROM, WHERE), in order to determine the columns being used, tables 
being accessed and columns being used in the where clause?

For simple SQL that has only one of the above clauses, may be simple (using 
substr, instr etc.), but it gets complicated with inline views, sub-queries 
etc.  

Would "Oracle Text" be of any significance here in order to do the parsing?

The idea is to use database auditing (using db,extended ) that would capture 
the SQL statement, but we could then parse the SQLs to see the column-access 
usage, table accessed in the SQL and the colums used in the where condition 
(this may also be present already in sys.column_usage, but I'm not sure).

Thanks,
Deepak


 
____________________________________________________________________________________
Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
--
//www.freelists.org/webpage/oracle-l


Other related posts: