I was studying tis question - How can I find which tables reference a given table in Oracle SQL Developer? ,
And It showed some code to find which tables reference a specified table :
elect table_name, constraint_name, status, owner
from all_constraints
where r_owner = :r_owner
and constraint_type = 'R'
and r_constraint_name in
(
select constraint_name from all_constraints
where constraint_type in ('P', 'U')
and table_name = :r_table_name
and owner = :r_owner
)
order by table_name, constraint_name
So I'm trying to tailor the code to get the tables that refer to a specific column (here , PREPARER_ID ) ; this is what I tried so far :
select column_name, constraint_name, status, owner
from all_constraints
where r_owner = :r_owner
and constraint_type = 'R'
and r_constraint_name in
(
select constraint_name from all_constraints
where constraint_type in ('P', 'U')
and column_name = :r_column_name
and owner = :r_owner
)
ORDER BY column_name, constraint_name
This gives me an error :
ORA-00904: "COLUMN_NAME": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 103 Column: 8