Suppose you have this Oracle 11g table:
table sample(
mykey int, --primary key
myval varchar2(10 byte) not null,
col1 varchar2(10 byte),
col2 varchar2(10 byte) default NULL)
If you execute this statement from sqldeveloper for example:
insert into sample(mykey, myval) values (1, 'test');
You get
mykey myval col1 col2
1 test null null
Note that it doesn't make a difference for the two nullable columns to specify the 'default null' or not, you'll still have 'null' entered as value for you.
Now, why does the exact same insert from JDBC driver fail with the 'Not enough values' error?
Furthermore, if the column col2 is defined without 'default null', but is still nullable, the JDBC insert works and sets 'null' for both col1 and col2.
Is it just superfluous or plain wrong to specify 'default null' for a column? If Oracle allows me to create the column with that default value and allows me to write SQL code that inserts as in the example correctly, I don't think it's wrong/illegal to do so.
Is this something related to the Oracle DB (or any DB for that matter) or could the application inserting via JDBC driver be issuing a wrong statement?
Thanks in advance