Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Sequences : Accessing and incrementing sequences : Using the CURRENT-VALUE function
 
Using the CURRENT-VALUE function
Use the CURRENT–VALUE function in any integer expression to retrieve the current value of a sequence without incrementing it. The current value of a sequence can be any of the following:
*The Initial value specified in the Dictionary
*The last value set with either the CURRENT–VALUE statement or the NEXT–VALUE function
The following example gets the most recent Customer number in the default database (maintained by the NextCustNum sequence), and displays each order record for that Customer:
DEFINE VARIABLE current–cust AS INTEGER NO-UNDO.
. . .
current-cust = CURRENT-VALUE(NextCustNum).

FOR EACH Order NO-LOCK WHERE Order.CustNum = current-cust:
  DISPLAY order.
  . . .