Quantcast
OracleBrains.Com header image 2

Initializing column with its default value?

December 30th, 2006 by Rajender Singh · No Comments

Today I found out this very interesting fact about default value.

While inserting or updating we can use reserver word “DEFAULT” to insert or update value of a column.

Example:

SQL> CREATE TABLE TEST1( NO VARCHAR2(10) DEFAULT ‘TEST’, NO1 VARCHAR2(10));

Table created.

SQL> INSERT INTO TEST1 VALUES(DEFAULT, DEFAULT);

1 row created.

SQL> UPDATE TEST1 SET NO=DEFAULT;

1 row updated.

Note: If DEFAULT value exist for a column it will be used or null will be used.


Tags: Oracle Administration · Oracle Database · SQL and PL/SQL

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Comment moderation is enabled. Your comment may take some time to appear.