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





From the docuementation I am guessing that an insert must have just been performed on that table before using this function, unlike the MAX() function that performs a table scan of any numeric column and returns the highest value regardless of when it was inserted.

From the Docs:
The value returned by the IDENTITY_VAL_LOCAL function is the value assigned to the identity column of the table identified in the most recent single row INSERT statement.

Reply via email to