Hey folks!
I have created a table with default values for fields like
CREATE TABLE T_EXAMPLE (
"VALUE" NUMBER(10,2) DEFAULT ON NULL 0
...
)
The compiler automatically adds 'NOT NULL ENABLE' so it looks like below:
CREATE TABLE T_EXAMPLE (
"VALUE" NUMBER(10,2) DEFAULT ON NULL 0 NOT NULL ENABLE
...
)
So when I insert null, 0 is actually inserted into the table - null is invalid as a value. This however does not seem to work when updating the table, as I get ORA-01407 error, if the update value is null. Why is that (Edit: Why is it implemented like that on a meta level)?
My solution was to add the coalesce()-function to the update command, to enforce the default value. This seems suboptimal to me when it comes to maintenance, as I have to change both, code and table-defaults, in case. Is there a preferable solution?
Thanks in advance.