Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL text parsing to obtains referenced tables and columns

401820Aug 22 2007 — edited Aug 22 2007

I wonder if anyone has a method of scanning an SQL statement to retrieve tables and columns referenced. EG:

select 
f.cola, f.colb, f.colc, b.cold
from
foo f, bar b
where
f.cola=b.cola and f.colb=b.colb
order by f.colz, b.cola

would provide

Tables
------
foo
bar

Columns
-------
foo.cola [SELECT] [WHERE]
foo.colb [SELECT] [WHERE]
foo.colc [SELECT]
foo.colz [ORDER BY]
bar.cola [WHERE] [ORDER BY]
bar.colb [WHERE]
bar.cold [SELECT]

The reason is that I'd like to query through several SQL scripts and validate tables and columns in a new version of the ERP system exist

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2007
Added on Aug 22 2007
17 comments
890 views