Add constraint for date type column
SQL>
SQL> CREATE TABLE product (
2 product_name VARCHAR2(25),
3 product_price NUMBER(4,2),
4 last_stock_date date
5 );
Table created.
SQL>
SQL> ALTER TABLE product ADD (
2 CONSTRAINT reasonable_date CHECK(
3 TO_CHAR(last_stock_date, 'YYYY-MM-DD') >= '2001-12-31'
4 )
5 );
Table altered.
SQL>
SQL>
SQL> drop table product;
Table dropped.
Related examples in the same category