db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Scott" <deni...@gmail.com>
Subject Re: IDENTITY_VAL_LOCAL() returns 2 rows
Date Tue, 19 Sep 2006 13:59:27 GMT
Use:

VALUES IDENTITY_VAL_LOCAL()

As the docs say: IDENTITY_VAL_LOCAL() is a "function that returns the
most recently assigned value of an identity column for a connection"
-- emphasis on _connection_. You can't select the latest value for a
specific table.

Dan

On 19/09/06, Tim Dudgeon <tdudgeon@informaticsmatters.com> wrote:
> Barry Books wrote:
> > try SELECT IDENTITY_VAL_LOCAL() from sysibm.sysdummy1
>
> Its get more weird!
> SELECT IDENTITY_VAL_LOCAL() from sysibm.sysdummy1
> returns 1 row
>
>
> SELECT IDENTITY_VAL_LOCAL() from the_actual_table_name
> returns as many rows as there are in the table, all with the value of
> the last ID.
>
> Tim
>
>

Mime
View raw message