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.
 
Mamta

 
On 7/5/05, Andy Jefferson <lists@ajsoft.net> wrote:
> If I'm understanding the question correctly, you should just use the
> "DEFAULT" keyword to perform the insert:
>
> INSERT INTO tbl VALUES (DEFAULT)

Thanks Army.

That's certainly the sort of thing I'm looking for, *however*, if I do
INSERT INTO tbl VALUES(DEFAULT);
VALUES IDENTITY_VAL_LOCAL();

I get back null !

This goes against my interpretation of the documentation
http://incubator.apache.org/derby/docs/10.0/manuals/reference/sqlj82.html#HDRIDENTITYVALLOCAL
since what I issues was a "single row INSERT statement", yet I get no value
back.


If I change my table and add another column and then issue
INSERT INTO tbl ("name") VALUES("new name")
VALUES IDENTITY_VAL_LOCAL();
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 ?


--
Andy