Dear Oracle Users
I have encountered with a tiny problem that needs your attention. I now it is a simple issue but it is important for me. I created a new table called employees_copy by copying first_name and commission_pct rows from employees table. I want to set DEFAULT value (0.5) for COMMISSION_PCT by altering table .I did it but when I insert new rows which included NULL values of COMMISSION_PCT and run select query I see that new row come with NULL value instead of 0.5. I have read that default value works only for new inserts but what is the problem now .I would appreciate if you help me.
create table employees_copy AS select first_name,commission_pct from employees;
update employees_copy set COMMISSION_PCT=NULL; // For Resetting COMMISSION_PCT with NULL values in order to set Default value
alter table employees_copy MODIFY ( COMMISSION_PCT DEFAULT '0.5' );
insert into employees_copy values ('TOM',NULL);
select * from employees_copy; //Please see picture for result. As you see now Default value took into effect.
