Using the CURRENT-VALUE statement
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Use the CURRENT–VALUE statement to explicitly set a sequence to a new value.
You can assign the defined initial value of a sequence, its upper or lower limit, or any
integer value in between. Trying to set a value outside these bounds causes an error. Note
that you cannot assign the Unknown value (?) to a sequence. Unlike the
NEXT–VALUE function, the CURRENT–VALUE statement always
sets a new sequence value in a transaction, starting one, if necessary.
The purpose of the CURRENT–VALUE statement is
to maintain a database off-line, under program control. Note that
the Data Dictionary uses this statement when you create a new sequence
to set the initial value. Possible uses include:
- Restarting a terminating sequence that has terminated
- Otherwise, resetting a sequence value for a specific test condition
Keep in mind that all such uses must respect and might require
changes to the _Sequence table. This table contains
one record for each sequence defined in the database. Creating a
record in this table automatically allocates and assigns the data
storage for a new sequence. Deleting a record in this table automatically
releases the data storage for the specified sequence.
OpenEdge provides fault detection that prevents a sequence
from being created with inconsistent attribute values in the _Sequence table
(such as, the minimum value greater than the maximum value). It
also prevents the assignment of a new current value that is inconsistent
with the corresponding attribute values in the _Sequence table
(such as, a current value outside the minimum and maximum value
boundary).
The following code fragment sets a new current value for sequence used for testing:
|
OpenEdge also uses this statement in the Data Administration tool to load sequence definitions and values from dump-formatted text files. You can accomplish the same task implemented in the code fragment above using this tool. For more information, see Manage the OpenEdge Database.