max(id) of empty table evaluates to null
843317Feb 28 2011 — edited Feb 28 2011Hello
I'm an absolute newbie to oracle and sql. My supervisor provided me this script
insert into country_property(id, country_id, name, value)
values ((select max(id) + 1 from country_property), (select country_code from country where name = 'TURKEY'), 'some_property', 't');
My problem is that the table is initially empty, such that max(id) evaluates to null which is forbidden by constraint. Can I fix that easily?
TIA, Bastl.
Edited by: 840314 on 28.02.2011 05:20 - NN constraint