Updating an oracle sequence via plsql

Oracle does not let you change the value of a sequence.If you need to change its value, you should re-create the sequence.

The downside of creating a sequence with a cache is that if a system failure occurs, all cached sequence values that have not be used, will be "lost".CREATE SEQUENCE gokhan.sample_seq START WITH 1000; SELECT last_number FROM user_sequences WHERE sequence_name = 'SAMPLE_SEQ'; LAST_NUMBER ----------- 1000 ALTER SEQUENCE gokhan.sample_seq INCREMENT BY -500; SELECT gokhan.sample_seq.NEXTVAL FROM dual; ALTER SEQUENCE gokhan.sample_seq INCREMENT BY 1; SELECT last_number FROM user_sequences WHERE sequence_name = 'SAMPLE_SEQ'; LAST_NUMBER ----------- 500 CREATE OR REPLACE PROCEDURE SYS.A sequence is an object in Oracle that is used to generate a number sequence.

This can be useful when you need to create a unique number to act as a primary key. The first sequence number that it would use is 1 and each subsequent number would increment by 1 (ie: 2,3,4,...}. If you omit the MAXVALUE option, your sequence will automatically default to: Now that you've created a sequence object to simulate an autonumber field, we'll cover how to retrieve a value from this sequence object.

This results in a "gap" in the assigned sequence values.

terrem43.ru

67 Comments

  1. Pingback:

  2. eric   •  

    Make your chat with strangers extremely interesting!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>