I think this might be a bug in Derby where VALUES IDENTITY_VAL_LOCAL(); returns null even after single row insert with values clause into table with identity column. A Jira entry would be good to keep track of this.
On 7/5/05, Andy Jefferson <email@example.com> wrote:
> If I'm understanding the question correctly, you should just use the
> "DEFAULT" keyword to perform the insert:
> INSERT INTO tbl VALUES (DEFAULT)
That's certainly the sort of thing I'm looking for, *however*, if I do
INSERT INTO tbl VALUES(DEFAULT);
I get back null !
This goes against my interpretation of the documentation
since what I issues was a "single row INSERT statement", yet I get no value
If I change my table and add another column and then issue
INSERT INTO tbl ("name") VALUES("new name")
I get back the value assigned to the identity column
Is there a way I can do an INSERT AND access the value assigned by Derby ?