CURRENT-VALUE function
Returns the current INT64 value of a sequence defined in the Data Dictionary.
Syntax
sequence
logical-dbname
An identifier that specifies the logical name of the database in which the sequence is defined. The database must be connected. You can omit this parameter if the sequence name is unambiguous. If a sequence with this name exists in more than one connected database, then you must specifylogical-dbname
.ExampleThe following example finds the current value of the NextCustNum sequence and then looks for Orders with that Customer number:
Notes
- The current value of a sequence can be one of the following:
- Sequence values are stored in the database in which they are defined, and persist between each invocation of the CURRENT-VALUE statement or NEXT-VALUE function.
- You cannot invoke the CURRENT-VALUE function from within a WHERE clause. Doing so generates a compiler error. To use a result from the CURRENT-VALUE function in a WHERE clause, assign the result to a variable, then use the variable in the WHERE clause.
- You can use any combination of the NEXT-VALUE function, CURRENT-VALUE function, CURRENT-VALUE statement, and their dynamic versions. Use the dynamic version when you don’t know what the database name or sequence name is at run time.
- Be careful when accessing a database sequence with an alias that points to a different database than the one used when the alias was defined. If you supply an alias name to the CURRENT-VALUE function or the NEXT-VALUE function, only the database used to define the alias is referenced. In this case, it is preferable to use the DYNAMIC-CURRENT-VALUE function and DYNAMIC-NEXT-VALUE function instead of the CURRENT-VALUE function and NEXT-VALUE function, respectively.
See alsoCURRENT-VALUE statement, DYNAMIC-CURRENT-VALUE function, DYNAMIC-CURRENT-VALUE statement, DYNAMIC-NEXT-VALUE function, NEXT-VALUE function
OpenEdge Release 10.2B
|