Sequence referenced NEXTVAL & CURRVAL pseudocolumns - Oracle Views, Sequences, and Synonyms

Q.  A sequence is referenced in SQL statements with the NEXTVAL and CURRVAL pseudocolumns, what can be used in the following places?

1) VALUES clause of INSERT statements
2) The SELECT list of a SELECT statement
3) The SET clause of an UPDATE statement

- Published on 12 Aug 15

c. Both A & B
d. None of the above

ANSWER: Both A & B


  • Nirja Shah   -Posted on 29 Sep 15
    - A sequence is a schema object that can generate unique sequential values.

    - These values are often used for primary and unique keys.

    - You can refer to sequence values in SQL statements with these pseudocolumns:

    1. CURRVAL - Returns the current value of a sequence

    2. NEXTVAL - Increments the sequence and returns the next value

    - You can use CURRVAL and NEXTVAL in the following locations:

    1. The select list of a SELECT statement that is not contained in a subquery, materialized view, or view

    2. The select list of a subquery in an INSERT statement

    3. The VALUES clause of an INSERT statement

    4. The SET clause of an UPDATE statement

Post your comment / Share knowledge

Enter the code shown above:
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)