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 »
Oracle »
Table »
Constraints:
- Adding a Constraint with CHECK
- Adding a NOT NULL Constraint
- Adding a FOREIGN KEY Constraint
- ON DELETE CASCADE
- ON DELETE SET NULL
- Adding a UNIQUE Constraint
- CHECK constraint
- Multiple Constraints
- Dropping a Constraint
- Disabling a Constraint
- Enabling a Constraint
- Deferred Constraints
- Getting Information on Constraints:user_constraints and all_constraints
Related: