Search
 
SCRIPT & CODE EXAMPLE
 

SQL

list foreign key oracle

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 :: mysql default uuid 
Sql :: mysql if statement in where clause 
Sql :: joins in sql 
Sql :: mysql server not running 
Sql :: square in sql 
Sql :: set column width in sqlplus 
Sql :: mysql decimal remove trailing zeros 
Sql :: select other columns with distinct 
Sql :: insert into postgres 
Sql :: mysql size of database 
Sql :: mysql nested query 
Sql :: match in sql server 
Sql :: like query 
Sql :: lost connection to mysql server during query when dumping table 
Sql :: insert data from one database table to another database table in postgresql using pgadmin 
Sql :: convert negative to positive in sql 
Sql :: mysql search multiple tables 
Sql :: dump sql file to database postgres 
Sql :: mysqldump devilbox 
Sql :: disable module odoo 
Sql :: create a plsql object 
Sql :: desinstaller mysql sur ubuntu definitivement 
Sql :: sql delete just one row 
Sql :: stuff in sql server 
Sql :: insert json file to mssql 
Sql :: how to dump .csv file into mysql 
Sql :: how to insert same table data using mysql query 
Sql :: Find the names of sailors who have reserved a red boat, and list in the order of age 
Sql :: oracle job schedules 
Sql :: insert into from 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =