Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How Can I get A sequence Current Value in PROC

RE: How Can I get A sequence Current Value in PROC

From: <G.Plivna_at_itsystems.lv>
Date: Mon, 26 Nov 2001 07:39:21 -0800
Message-ID: <F001.003CCCC5.20011126070521@fatcity.com>

I don't know
But You can get last_number from dba/user_sequences view

I just looked at this view and found some interesting results

If sequence is "nocache" then it seems last_number really is the last number
But if some sequence values are stored in cache then last number values are something like

starting_value + n * increment_by * cache_size

enjoy!!! :-)

I don't know if it is written somewhere in the docs.

Gints Plivna
IT Sistēmas, Merķeļa 13, LV1050 Rīga
http://www.itsystems.lv/gints/

                                                                                       
                             
                    "Cale, Rick T                                                      
                             
                    (Richard)"            To:     Multiple recipients of list ORACLE-L 
<ORACLE-L_at_fatcity.com>       
                    <RICHARD.T.CALE       cc:                                          
                             
                    @saic.com>            Subject:     RE: How Can I get A sequence 
Current Value in PROC           
                    Sent by:                                                           
                             
                    root_at_fatcity.co                                                    
                             
                    m                                                                  
                             
                                                                                       
                             
                                                                                       
                             
                    2001.11.26                                                         
                             
                    16:30                                                              
                             
                    Please respond                                                     
                             
                    to ORACLE-L                                                        
                             
                                                                                       
                             
                                                                                       
                             




Does anyone know why Oracle forces you to use NEXTVAL before doing CURRVAL. I would think sometimes you would want to use CURRVAL without incrementing sequence first.

Thanks
Rick

-----Original Message-----
Sent: Monday, November 26, 2001 8:50 AM
To: Multiple recipients of list ORACLE-L

You can use another pseducolumn CURRVAL but you must use at least once per session the NEXTVAL before using the CURRVAL or else you would get the ORA-08002 error.

...

SELECT <your_sequence>.CURRVAL INTO <your_variable> FROM dual;
...

HTH
Iulian

-----Original Message-----
Sent: Monday, November 26, 2001 2:50 PM
To: Multiple recipients of list ORACLE-L



This email has been tested for viruses by F-Secure Antivirus administered by IT Network Department.

Hi

when writing a program PROC <sequenceName>.NEXTVAL points to the next value of a sequence, is there anything like <sequenceName>.SOMETHING that returns current value of sequence.

Thanks

E.



Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: ehsan sinavalda
  INET: ehsanoracle_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).


****************************************************************************

**
The information contained in this communication is confidential and
may be legally privileged. It is intended solely for the use of the
individual or entity to whom it is addressed and others authorised to
receive it. If you are not the intended recipient you are hereby
notified that any disclosure, copying, distribution or taking action in
reliance of the contents of this information is strictly prohibited and
may be unlawful. Mobil Rom is neither liable for the proper, complete
transmission of the information contained in this communication nor
any delay in its receipt.
****************************************************************************

**

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: Iulian.ILIES_at_mobil-rom.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Cale, Rick T (Richard)
  INET: RICHARD.T.CALE_at_saic.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: G.Plivna_at_itsystems.lv

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Nov 26 2001 - 09:39:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US