Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle find foreign key dependencies

SELECT c.OWNER, a.TABLE_NAME, a.COLUMN_NAME, a.CONSTRAINT_NAME, 
       c.R_OWNER AS REF_OWNER, cpk.TABLE_NAME AS REF_TABLE, 
       cpk.CONSTRAINT_NAME AS REF_PK
FROM ALL_CONS_COLUMNS a 
JOIN ALL_CONSTRAINTS c ON a.OWNER = c.OWNER
    AND a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
 JOIN ALL_CONSTRAINTS cpk ON c.R_OWNER = cpk.OWNER
    AND c.R_CONSTRAINT_NAME = cpk.CONSTRAINT_NAME
WHERE c.CONSTRAINT_TYPE = 'R' AND c.TABLE_NAME= 'table_name';
Comment

PREVIOUS NEXT
Code Example
Sql :: what is non relational database 
Sql :: sql select most frequent value in group 
Sql :: sql insert data 
Sql :: dublicate row sql 
Sql :: sql like case sensitive 
Sql :: make parameters nullable in sql server 
Sql :: mysql mediumtext 
Sql :: import database mysql command line 
Sql :: export database sql file from xampp using cmd 
Sql :: sql query to return field name of a table 
Sql :: SQL Server OPENJSON FROM table column 
Sql :: when matched in sql server 
Sql :: mssql remove duplicate rows 
Sql :: mysql order by on condition 
Sql :: SQL IS NULL With COUNT() 
Sql :: postgres stored procedure 
Sql :: sql change column name based on value 
Sql :: plpgsql coalesce equivalent for empty string 
Sql :: sql trying to delete database in use 
Sql :: create postgres role and database for bitbucket 
Sql :: show database not empty tables postgres 
Sql :: mysqli_free_result 
Sql :: mysql error the maximum column size is 767 bytes. 
Sql :: Host ' is not allowed to connect to this MySQL server 
Sql :: sqlite higher or equal 
Sql :: sql where clause 
Sql :: compound trigger oracle 
Sql :: grapgql 
Sql :: how to put 0 or 000 depending IDCustomer length in sql server 
Sql :: select top values sql 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =