I have a number column on a table called SampleTable which is defined as follows
ID Number(10) DEFAULT 1
I have a trigger on different table(SomeTable) and UPDATE EACH ROW (Trigger – :New.ID) which inserts value from that table(SomeTable) into the SampleTable.
Sometimes the ID from SomeTable can be NULL and I wanted to SampleTable to insert the default value 1 in my case.
But it inserts NULL(Blankspace) on the table.
I am kinda new to PL/SQL so any help is greatly appreciated.
A column default is only used if the column is not specified in the insert:
It is not used if the column has been specified, even if a NULL has been passed in:
To deal with this, your trigger can do this: