|
Re: how to find out referred columns of master table? [message #371593 is a reply to message #371590] |
Fri, 10 November 2000 07:34 |
Babu Paul
Messages: 38 Registered: November 2000
|
Member |
|
|
Hi,
Basically to get information about these referential constraints we need to look into all_cons_columns and all_constraints tables. The follwing query will ease your job:
SELECT a.table_name child_table, a.column_name child_column, b.table_name parent_table, b.column_name parent_column FROM all_cons_columns a, all_cons_columns b, all_constraints c
WHERE a.table_name = upper('Your table name')
AND b.constraint_name = c.r_constraint_name
AND c.table_name = a.table_name
AND c.constraint_type = 'R'
AND a.constraint_name = c.constraint_name
/
Good Luck
Babu
|
|
|
|
Re: how to find out referred columns of master table? [message #371603 is a reply to message #371593] |
Mon, 13 November 2000 04:53 |
Babu Paul
Messages: 38 Registered: November 2000
|
Member |
|
|
Hi,
It's quite easy to change the query you know, replace table name as a search criteria to point it to your foreign key constraint name. I have modified the query. Please have a look.
SELECT a.table_name child_table, a.column_name child_column, b.table_name parent_table, b.column_name parent_column FROM all_cons_columns a, all_cons_columns b, all_constraints c
WHERE c.constraint_name = upper('your foreign key constraint name')
AND b.constraint_name = c.r_constraint_name
AND c.table_name = a.table_name
AND c.constraint_type = 'R'
AND a.constraint_name = c.constraint_name
/
Good Luck!
Babu
|
|
|
|