Consultor Eletrônico



Kbase P183766: How to use sequences in OpenEdge SQL
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/03/2011
Status: Unverified

GOAL:

How to use sequences in OpenEdge SQL

GOAL:

Example of NEXTVAL in an INSERT statement

GOAL:

Example of CURRVAL and NEXTVAL in a SELECT statement

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.1E
OpenEdge 10.x

FIX:

Sequences in an OpenEdge database can be accessed through OpenEdge SQL using the CURRVAL and NEXTVAL functions. CURRVAL returns the current value of a sequence. NEXTVAL increments the sequence value by the defined increment and returns the new value. References to CURRVAL and NEXTVAL use the following syntax:
schema.sequence.CURRVAL
schema.sequence.NEXTVAL
For example:
SELECT PUB.NextCustNum.CURRVAL from PUB.Customer WHERE CustNum = 1
SELECT PUB.NextCustNum.NEXTVAL from PUB.Customer WHERE CustNum = 1
INSERT INTO PUB.Customer VALUES (PUB.Customer.NEXTVAL,?USA?,?BackCountry Equipment?,?Sugar Hill Road?,?12A?,?Franconia?,?NH?,?03242?,?Dan Egan?,?603-762-2121?,?Kirsten Ulmner?, 10000.00, 500.00,?net 10?, 0,?contact monthly?)