Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 8. Changing Table Contents > Using Default Values

Using Default Values

The Oracle9i database introduced a new feature that allows you to define a default value for a column. For example, the following statement creates a table named order_status that has two columns named status and last_modified. The status column is defaulted to Order placed and the last_modified column is defaulted to the value returned by the SYSDATE function:

CREATE TABLE order_status (
  order_status_id INTEGER
    CONSTRAINT default_example_pk PRIMARY KEY,
  status VARCHAR2(20) DEFAULT 'Order placed' NOT NULL,
  last_modified DATE DEFAULT SYSDATE
);


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial