Skip to content

Instantly share code, notes, and snippets.

@mvaz
Created December 12, 2011 19:59
Show Gist options
  • Select an option

  • Save mvaz/1468832 to your computer and use it in GitHub Desktop.

Select an option

Save mvaz/1468832 to your computer and use it in GitHub Desktop.
Getting metadata from oracle sql tables
select --*
col.table_name, col.column_name, cc.constraint_name , rel.table_name, rel.column_name
from user_tab_columns col,
user_cons_columns con,
user_constraints cc,
user_cons_columns rel
where col.table_name = con.table_name
and col.column_name = con.column_name
and con.constraint_name = cc.constraint_name
and cc.constraint_type = 'R'
and cc.r_constraint_name = rel.constraint_name
and con.position = rel.position
;
select distinct table_name
from user_tab_columns col
where table_name not like 'BIN%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment