Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Table
 

Using Default Values

Define a default value for a column. last_modified column is defaulted to the value returned by the SYSDATE function. SQL> SQL> CREATE TABLE myTable (   2    id INTEGER,   3    status VARCHAR2(20) DEFAULT 'Order placed' NOT NULL,   4    last_modified DATE DEFAULT SYSDATE   5  ); Table created. SQL> SQL> drop table myTable; Table dropped.