Oracle

Constraint Information (table level)

Figo Kim 2006. 11. 27. 21:44
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

- USER_CONSTRAINTS : Constraint definitions on your tables.

DESCRIBE user_constraints;

Name Null? Type
OWNER NOT NULL VARCHAR2(30)
CONSTRAINT_NAME NOT NULL VARCHAR2(30)
CONSTRAINT_TYPE   VARCHAR2(1)
TABLE_NAME NOT NULL VARCHAR2(30)
SEARCH_CONDITION   LONG
R_OWNER   VARCHAR2(30)
R_CONSTRAINT_NAME   VARCHAR2(30)
DELETE_RULE   VARCHAR2(9)
STATUS   VARCHAR2(8)
DEFERRABLE   VARCHAR2(14)
DEFERRED   VARCHAR2(9)
VALIDATED   VARCHAR2(13)
GENERATED   VARCHAR2(14)
BAD   VARCHAR2(3)
RELY   VARCHAR2(4)
LAST_CHANGE   DATE
INDEX_OWNER   VARCHAR2(30)
INDEX_NAME   VARCHAR2(30)
INVALID   VARCHAR2(7)
VIEW_RELATED   VARCHAR2(14)

- table name, check constraints, foreign key constraint, deletion rule for foreign key constraints, the status, and so on.

SELECT constraint_name, constraint_type, search_condition, r_constraint_name, delete_rule, status FROM user_constraints WHERE table_name = 'EMPLOYEES';

CONSTRAINT_
NAME
CON SEARCH_CONDITION R_CONSTRAINT
_NAME
DELETE_RULE STATUS
EMP_LAST_NAME_NN C "LAST_NAME" IS NOT NULL     ENABLED
EMP_EMAIL_NN C "EMAIL" IS NOT NULL     ENABLED
EMP_HIRE_DATE_NN C "HIRE_DATE" IS NOT NULL     ENABLED
EMP_JOB_NN C "JOB_ID" IS NOT NULL     ENABLED
EMP_SALARY_MIN C salary > 0     ENABLED
EMP_EMAIL_UK U       ENABLED
EMP_EMP_ID_PK P       ENABLED
EMP_DEPT_FK R   DEPT_ID_PK NO ACTION ENABLED
EMP_JOB_FK R   JOB_ID_PK NO ACTION ENABLED
EMP_MANAGER_FK R   EMP_EMP_ID_PK NO ACTION ENABLED
10 rows selected.

CONSTRAINT TYPE :
  • C : check constraint on a table
  • P : Primary key
  • U : Unique Key
  • R : Referential integrity
  • V : with check option, on a view
  • O : with read-only, on a view

DELETE_RULE :

  • CASCADE : If the parent record is deleted, the child records are deleted too.
  • NO ACTION : A parent record can be deleted only if no child record exist.

STATUS :
  • ENABLED : Constraint is active.
  • DISABLED : Constraint is made not active.

'Oracle' 카테고리의 다른 글

Constraint Information (column level)  (0) 2006.11.27
Constraint Information (table level)  (0) 2006.11.27
Column Information  (0) 2006.11.27
Column Information  (0) 2006.11.27
Table Information  (0) 2006.11.27