Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how default option prevents null values from entering the columns when a row is inserted without a v

939393Feb 20 2014 — edited Feb 20 2014

Dear all,

how default option prevents null values from entering the columns when a row is inserted without a value for the column in oracle. But when i specify a column with a default option it inserts null value

create table hire_dates

(id number(8),

hire_date date default sysdate);

SQL> insert into hire_dates

  2  values(100,null);

1 row created.

SQL> select * from hire_dates;

        ID HIRE_DATE

---------- ---------

       100

But When i do this

SQL> insert into hire_dates(id)

  2  values(200);

1 row created.

SQL> select * from hire_dates;

        ID HIRE_DATE

---------- ---------

       100

       100

       200 20-FEB-14

So can anyone from all you seniors help me to understand how Default option will work

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2014
Added on Feb 20 2014
2 comments
1,825 views