Search
 
SCRIPT & CODE EXAMPLE
 

SQL

oracle get foreign keys on table

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 :: psql show db 
Sql :: Create the connection pool mysql2 
Sql :: mysql switch case 
Sql :: local database sql 
Sql :: mysql 5.6 hierarchical recursive query 
Sql :: mysql last friday of current month 
Sql :: sql group by 
Sql :: how to get column name in db from an sqlalchemy attribute model 
Sql :: t-sql add column 
Sql :: full outer join postgres 
Sql :: Write SQL in ruby on rails 
Sql :: date less than in sql 
Sql :: control files oracle 
Sql :: sql exemplos 
Sql :: SQL FETCH FIRST Clause 
Sql :: get only one row in mysql 
Sql :: sql order of operations 
Sql :: SQL/update 
Sql :: SQL AVG() Function 
Sql :: inser into example 
Sql :: c# sql conennection string 
Sql :: how to average max mysql 
Sql :: mariadb search columns 
Sql :: oracle diskgroup 
Sql :: rename temp table column name in sql server 
Sql :: postgres insert timestamp without timezone 
Sql :: create column that already exists mysql 
Sql :: order by in codeigniter query builder 
Sql :: sql constraint to check date less than current date 
Sql :: how to fetch data from database without last column 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =