ablog

不器用で落着きのない技術者のメモ

表にかけられている制約を確認するSQL

select constraint_name, constraint_type
	from all_constraints
	where owner = upper('&owner')
		and table_name = upper('&table');
  • 実行例
SQL> select constraint_name, constraint_type
        from all_constraints
        where owner = upper('&owner')
  2    3    4           and table_name = upper('&table');
Enter value for owner: scott
old   3:        where owner = upper('&owner')
new   3:        where owner = upper('scott')
Enter value for table: emp
old   4:                and table_name = upper('&table')
new   4:                and table_name = upper('emp')

CONSTRAINT_NAME                C
------------------------------ -
EMP_FK                         R

...

EMP_UK                         U
EMP_PK                         P
SYS_C00277633                  C
SYS_C00277632                  C
SYS_C00277631                  C
SYS_C00277630                  C
SYS_C00277629                  C
SYS_C00277628                  C
SYS_C00277627                  C
SYS_C00277626                  C
SYS_C00277625                  C
SYS_C00277624                  C
SYS_C00277623                  C
SYS_C00277622                  C
SYS_C00277621                  C
SYS_C00277620                  C
SYS_C00277619                  C
SYS_C00277618                  C
SYS_C00277617                  C
SYS_C00277616                  C
SYS_C00277615                  C
SYS_C00277614                  C
SYS_C00277613                  C
SYS_C00277612                  C
SYS_C00277611                  C

35 rows selected.