Hi, it has many ways to solve it (each developer has his way to do this)

I perefere something like this:

SELECT *
FROM  user_tab_column tc
, (select target_table table_name
from tab1
UNION
select source_table table_name
from tab1
) t
WHERE t.table_name = tc.table_name
;

UNION is there because I want only distinct set of table names
and I am often surprised how UNION ALL outperforms LEFT OUTER JOINS or DECODE in SELECT clause (not always - highly depends on schema model and indexes mainly)

best regards
    hoppo


On 12. 3. 2011 23:11, gayathri Dev wrote:
Hi All,

I have 2 queries.

Query 1:
select target_table, source_table
from tab1

I want to use each row at a time returned by Query 1 in Query 2.

Query 2:

select * from user_tab_column
where table_name in (tab1.target_table, tab1.source_table)

Please let me know how can I merge these 2 queries in one.

Thanks,
G.
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to