Chapter 3 DBMS Reference Guide
SQL query used to list the tables referenced by a table.
In Oracle 9i:
{OWNER, TABLE, POWNER, PARENT}
select
c.owner,
c.table_name,
r.owner,
r.table_name
from
sys.all_constraints c,
sys.all_constraints r
where
(c.constraint_type = 'R' and c.r_constraint_name = r.constraint_name and c.r_owner = r.owner)
[ and c.owner = %.q:SCHEMA%]
[ and c.table_name = %.q:TABLE%]
union select
c.owner,
c.table_name,
r.owner,
r.table_name
from
sys.all_constraints c,
sys.all_constraints r
where
(r.constraint_type = 'R' and r.r_constraint_name = c.constraint_name and r.r_owner = c.owner)
[ and c.owner = %.q:SCHEMA%]
[ and c.table_name = %.q:TABLE%]
order by 1, 2, 3, 4
| Copyright (C) 2005. Sybase Inc. All rights reserved. |
| |