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: strange behaviour of sequence

RE: strange behaviour of sequence

From: Naveen Nahata <naveen_nahata_at_mindtree.com>
Date: Wed, 29 Jan 2003 03:18:45 -0800
Message-ID: <F001.0053D049.20030129031845@fatcity.com>


Ther is something called 'cache' in a sequence definition which has a default value of 20. Which means 20 values of the sequence will be pre-fetched and kept in the memory.

this is done to avoid latching issues.

when u shutdown the instance the pre-fetched values are lost, and they are not rolled back. hence you get value 21 after 4 because u might have restarted the instance after 4 inserts.

Since default is 20, values 1-20 were cached and at the next start, 21-40 was cached and value 21, 22 etc were given to you.

Regards
Naveen

-----Original Message-----
Sent: Wednesday, January 29, 2003 4:04 PM To: Multiple recipients of list ORACLE-L

Guys,

one of my developers is using sequence to auto-increment the value of a column while inserting.

he has created a sequence like this.

SQL > create sequence testseq start with 1;

and then uses a INSERT statement as below in a JSP.

insert into testtab values ('BREAD'||testseq.nextval);

after some inserts .....when he does SELECT from TESTTAB...he finds
the values as :

BREAD1
BREAD2
BREAD3
BREAD4
BREAD21
BREAD22 it should increment by 1.but it is not so ?

any hint/clue ????

Regards,
Jp.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: oraora oraora
  INET: oraoraora_at_rediffmail.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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).

DISCLAIMER:
This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission.
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Naveen Nahata
  INET: naveen_nahata_at_mindtree.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
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 Wed Jan 29 2003 - 05:18:45 CST

Original text of this message

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