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: Reset Sequence code

RE: Reset Sequence code

From: Malik, Fawzia <Fawzia.Malik_at_bskyb.com>
Date: Fri, 05 Jul 2002 06:13:29 -0800
Message-ID: <F001.0049030C.20020705061329@fatcity.com>


brilliant that's exactly what I wanted- thankyou all!!

-----Original Message-----
Sent: 05 July 2002 14:48
To: Multiple recipients of list ORACLE-L

NO, you dont need to DROP the sequence, here is demo code i used to reset a sequence(this resets it back to 1).  

SQL> drop sequence test_seq;  

Sequence dropped.  

SQL> create sequence test_seq;  

Sequence created.  

SQL>
SQL> declare
  2 seq_hold_var number;
  3 begin
  4 for i in 1 .. 100000 loop
  5 select test_seq.nextval into seq_hold_var from dual;   6 end loop;
  7 end;
  8 /  

PL/SQL procedure successfully completed.  

SQL>
SQL> select test_seq.nextval from dual;  

   NEXTVAL


    100001  

SQL>
SQL> alter sequence test_seq increment by -100000;  

Sequence altered.  

SQL>
SQL> select test_seq.nextval from dual;  

   NEXTVAL


         1  

SQL>
SQL> alter sequence test_seq increment by 1;  

Sequence altered.



Information in this email is confidential and may be privileged. It is intended for the addressee only. If you have received it in error, please notify the sender immediately and delete it from your system. You should not otherwise copy it, retransmit it or use or disclose its contents to anyone.
Thank you for your co-operation.

--

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

Author: Malik, Fawzia
  INET: Fawzia.Malik_at_bskyb.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). Received on Fri Jul 05 2002 - 09:13:29 CDT

Original text of this message

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