NEXTVAL - Definition - Oracle Views, Sequences, and Synonyms

Q.  What is a Sequence with each new sequence number that is generated by a reference to the sequence pseudocolumn called?
- Published on 12 Aug 15

a. CURRVAL
b. NEXTVAL
c. Both A & B
d. None of the above

ANSWER: NEXTVAL
 

    Discussion

  • Nirja Shah   -Posted on 29 Sep 15
    - A sequence is referenced in SQL statements with the NEXTVAL and CURRVAL pseudocolumns.

    - Each new sequence number is generated by a reference to the sequence pseudocolumn NEXTVAL.

    - The current sequence number can be repeatedly referenced using the pseudo-column CURRVAL.

    - NEXTVAL and CURRVAL are not reserved words or keywords and can be used as pseudocolumn names in SQL statements such as SELECT, INSERT, or UPDATE.

    - You must qualify CURRVAL and NEXTVAL with the name of the sequence:

    sequence.CURRVAL
    sequence.NEXTVAL

    - To refer to the current or next value of a sequence in the schema of another user, you must have been granted either SELECT object privilege on the sequence or SELECT ANY SEQUENCE system privilege, and you must qualify the sequence with the schema containing it:

    schema.sequence.CURRVAL
    schema.sequence.NEXTVAL

    - To refer to the value of a sequence on a remote database, you must qualify the sequence with a complete or partial name of a database link:

    schema.sequence.CURRVAL@dblink
    schema.sequence.NEXTVAL@dblink

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.)