Consultor Eletrônico



Kbase P167865: SQL: Is there a function equivalent to the MS SQL Server @@identity system function that returns the
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/06/2010
Status: Unverified

GOAL:

SQL: Is there a function equivalent to the MS SQL Server @@identity system function that returns the last inserted identity value in an OpenEdge SQL application session?

GOAL:


How to retrieve the last record inserted in an OpenEdge SQL application session?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

OpenEdge SQL does not have a function equivalent to the MS SQL Server @@identity system function that returns the last inserted identity value. However, a solution to retrieving the last inserted record in an SQL application session is to use the SQL SEQUENCE object NEXTVAL method as follows:
1. Use a the schema.sequence.NEXTVAL method to generate a sequence record 'identity'.
2. Save the schema.sequence.NEXTVAL value in an application variable.
3. Use the application variable to retrieve the last inserted record.