Multiple Constraints

A table may be declared with multiple constraints.


SQL> CREATE TABLE VENDORS
  2  (ID           NUMBER CONSTRAINT VENDOR_ID_PK PRIMARY KEY,
  3   NAME         VARCHAR2(20) NOT NULL,
  4   STATUS       NUMBER(1) CONSTRAINT STATUS_NN NOT NULL,
  5   CATEGORY     VARCHAR2(20),
  6   CONSTRAINT   STATUS_CK CHECK (STATUS IN (4, 5)),
  7   CONSTRAINT   CATEGORY_CK CHECK (CATEGORY IN ('Active','Suspended','Inactive'))
  8  );

Table created.

SQL>
Home »
Oracle »
Table » 

Constraints:
  1. Adding a Constraint with CHECK
  2. Adding a NOT NULL Constraint
  3. Adding a FOREIGN KEY Constraint
  4. ON DELETE CASCADE
  5. ON DELETE SET NULL
  6. Adding a UNIQUE Constraint
  7. CHECK constraint
  8. Multiple Constraints
  9. Dropping a Constraint
  10. Disabling a Constraint
  11. Enabling a Constraint
  12. Deferred Constraints
  13. Getting Information on Constraints:user_constraints and all_constraints
Related: