CURRVAL
Returns the last value across all nodes that was set by NEXTVAL
on this sequence in the current session. If NEXTVAL
was never called on this sequence since its creation, Vertica returns an error.
Behavior Type
Syntax
CURRVAL('[[database.]schema.]sequence-name')
Parameters
[database.]schema
|
Specifies a schema, by default myschema.thisDbObject If you specify a database, it must be the current database. |
sequence‑name |
The target sequence |
Privileges
- SELECT privilege on sequence
- USAGE privilege on sequence schema
Restrictions
You cannot invoke CURRVAL
in a SELECT
statement, in the following contexts:
WHERE
clauseGROUP BY
clauseORDER BY
clauseDISTINCT
clauseUNION
- Subquery
You also cannot invoke CURRVAL
to act on a sequence in:
- UPDATE or DELETE subqueries
- Views
Examples
See Creating and Using Named Sequences in the Administrator's Guide