[EMAIL PROTECTED] wrote:
> Greetings! > > I'm experiencing a problem using the IDENTITY_VAL_LOCAL function. Any > query with this function fails with an SQLException with message: > > Unexpected token: IDENTITY_VAL_LOCAL in statement ........ > > I have the identity column in one of my tables, on which I successfully > perform single-record inserts. Well, it seems it just doesn't even > parse! I'm really upset about it. I have to use a workaround like: > > SELECT MAX(TABLE_ID) FROM MY_TABLE; > > instead of IDENTITY_VAL_LOCAL(). > > Can anyone help? > > I'm using: > JRE 1.4.2 > Apache DERBY v.1.7.3 > > Thanks! > Michael. Hi Michael, Following is an example of how you would use IDENTITY_VAL_LOCAL() in your sql. You can find more examples in functionTests/tests/lang/autoincrement.sql ij> create table t1 (x int, s1 int generated always as identity); 0 rows inserted/updated/deleted ij> insert into t1 (x) values (1); 1 row inserted/updated/deleted ij> values IDENTITY_VAL_LOCAL(); 1 ------------------------------- 1 ij> insert into t1 (x) values (2); 1 row inserted/updated/deleted ij> values IDENTITY_VAL_LOCAL(); 1 ------------------------------- 2 Also, you can find documentation on IDENTITY_VAL_LOCAL at following location in the Reference Manual http://incubator.apache.org/derby/manuals/reference/sqlj82.html#HDRIDENTITYVALLOCAL. Hope this helps, Mamta
