SQL>
SQL> CREATE TABLE purchase (
2 product_name VARCHAR2(25),
3 product_price NUMBER(4,2),
4 purchase_date DATE
5 );
Table created.
SQL>
SQL> ALTER TABLE purchase ADD (
2 CONSTRAINT reasonable_date CHECK(
3 purchase_date IS NOT NULL
4 AND
5 TO_CHAR(purchase_date, 'YYYY-MM-DD') >= '2000-06-30'
6 )
7 );
Table altered.
SQL>
SQL> INSERT INTO purchase VALUES ('Small Widget', 10, '28-FEB-00');
INSERT INTO purchase VALUES ('Small Widget', 10, '28-FEB-00')
*
ERROR at line 1:
ORA-02290: check constraint (RNTSOFT.REASONABLE_DATE) violated
SQL>
SQL>
SQL>
SQL> drop table purchase;
Table dropped.