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 get table and column names ?

fxmatzDec 23 2013 — edited Dec 24 2013

Hi Friends,

is there a solution on 11i or 12c DB's to get the table and column names of the result columns from a complex SQL text ?

Here a little demo:

Input::

select a.cola,

         b.coly   alias_b.colb,

         (select x.colx from tablex)   alias_x.colx

    from tablea a,

         (select coly from tabley y where a.id=y.taby_a) b

    where a.id exists (select 1 from tablex x where x.id=a.taba_x

    /

 

Output::

  table   column

  -------------

  tablea  cola

  tablex  colx

  tabley  coly

I have seen a solution a while ago ..

One possibility would be with util_xml but this goes only for non-complex SQL's.

Many thanks.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 21 2014
Added on Dec 23 2013
5 comments
3,284 views