CURRVAL
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
CURRVAL returns the current value
of a sequence, and uses the following syntax to reference the current
value of a sequence.
Syntax
|
schema.sequence.
|
Parameters
- schema
-
Specifies the schema that contains the sequence. To refer to the current value of a sequence in the schema of another user, you must have
SELECTobject privilege on the sequence. - sequence
-
Specifies the name of the sequence whose current value you want.
Use
CURRVALin:- The
SELECTlist of aSELECTstatement not contained in a subquery or view - The
SELECTlist of a subquery in anINSERTstatement - The
VALUESclause of anINSERTstatement - The
SETclause of anUPDATEstatement
CURRVALcannot be used in:- A query of a view
- A
SELECTstatement with aGROUP BYclause that references a sequence - A
SELECTstatement with anORDER BYclause that references a sequence - A
SELECTstatement that is combined with anotherSELECTstatement with theUNION,INTERSECT, orMINUSset operator - The
WHEREclause of aSELECTorUPDATEstatement - The
DEFAULTvalue of a column in aCREATE TABLEorALTER TABLEstatement - The condition of a
CHECKconstraint
- The
Example
In the following example, the OpenEdge SQL sequence generator returns the current value of the customer sequence:
|