Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    3

    Unanswered: how to get current value of sequence?

    SELECT seq_01.currval FROM dual;

    error: ORA-02008


    but I do not want to modify the value of the sequence.

    thanks in advanced

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    too bad COPY & PASTE are broken for you.
    Code:
    08002, 00000, "sequence %s.CURRVAL is not yet defined in this session"
    // *Cause: sequence CURRVAL has been selected before sequence NEXTVAL
    // *Action: select NEXTVAL from the sequence before selecting CURRVAL
    Code:
    SQL> SELECT UTL_RECOMP_SEQ.CURRVAL FROM DUAL;
    SELECT UTL_RECOMP_SEQ.CURRVAL FROM DUAL
           *
    ERROR at line 1:
    ORA-08002: sequence UTL_RECOMP_SEQ.CURRVAL is not yet defined in this session
    
    SQL> select last_number from dba_sequences where SEQUENCE_NAME = 'UTL_RECOMP_SEQ';
    
    LAST_NUMBER
    -----------
    	  0
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    LAST_NUMBER will not be accurate if your sequence is defined with a CACHE > 1 !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •