1SELECT cons.OWNER AS CHILD_OWNER,
2 cons.TABLE_NAME AS CHILD_TABLE,
3 cons.CONSTRAINT_NAME AS CONSTAINT_NAME,
4 cons.CONSTRAINT_TYPE AS CONSTRAINT_TYPE,
5 col.OWNER AS PARENT_OWNER,
6 col.TABLE_NAME AS PARENT_TABLE,
7 col.COLUMN_NAME AS COLUMN_NAME
8FROM DBA_CONS_COLUMNS col, DBA_CONSTRAINTS cons
9WHERE cons.R_OWNER = col.OWNER
10 AND cons.R_CONSTRAINT_NAME = col.CONSTRAINT_NAME
11 AND cons.TABLE_NAME = 'table_name';
1SELECT c.OWNER, a.TABLE_NAME, a.COLUMN_NAME, a.CONSTRAINT_NAME,
2 c.R_OWNER AS REF_OWNER, cpk.TABLE_NAME AS REF_TABLE,
3 cpk.CONSTRAINT_NAME AS REF_PK
4FROM ALL_CONS_COLUMNS a
5JOIN ALL_CONSTRAINTS c ON a.OWNER = c.OWNER
6 AND a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
7 JOIN ALL_CONSTRAINTS cpk ON c.R_OWNER = cpk.OWNER
8 AND c.R_CONSTRAINT_NAME = cpk.CONSTRAINT_NAME
9WHERE c.CONSTRAINT_TYPE = 'R' AND c.TABLE_NAME= 'table_name';
1CREATE TABLE hr.admin_emp (
2 empno NUMBER(5) PRIMARY KEY,
3 ename VARCHAR2(15) NOT NULL,
4 ssn NUMBER(9) ENCRYPT,
5 job VARCHAR2(10),
6 mgr NUMBER(5),
7 hiredate DATE DEFAULT (sysdate),
8 photo BLOB,
9 sal NUMBER(7,2),
10 hrly_rate NUMBER(7,2) GENERATED ALWAYS AS (sal/2080),
11 comm NUMBER(7,2),
12 deptno NUMBER(3) NOT NULL
13 CONSTRAINT admin_dept_fkey REFERENCES hr.departments
14 (department_id))