A check constraint can also be created or added as a table constraint.
SQL>
SQL> CREATE TABLE myTable
2 (policy_id NUMBER
3 ,holder_name VARCHAR2(40)
4 ,gender VARCHAR2(1) constraint chk_gender CHECK (gender in ('M','F')) --inline syntax
5 ,marital_status VARCHAR2(1)
6 ,date_of_birth DATE
7
8 ,constraint chk_marital CHECK (marital_status in ('S' ,'M' ,'D' ,'W'))
9 );
Table created.
SQL>
SQL> drop table myTable;
Table dropped.
SQL>
Related examples in the same category