Skip to content

Instantly share code, notes, and snippets.

@andreia
Created October 25, 2012 01:34
Show Gist options
  • Select an option

  • Save andreia/3949980 to your computer and use it in GitHub Desktop.

Select an option

Save andreia/3949980 to your computer and use it in GitHub Desktop.
Oracle: Foreign constraints
select f.constraint_name, f.table_name tabela_filha, p.table_name tabela_pai
from user_constraints f, user_constraints p
where f.constraint_type = 'R'
and f.r_constraint_name = p.constraint_name
-- constraint_type (http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_1037.htm):
-- R -> Referential (FK)
-- C -> Check constraint on a table
-- P -> Primary Key
-- U -> Unique Key
-- V -> With check option, on a view
-- O -> With read only, on a view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment