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.
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment