Oracle sequence Learning

Source: Internet
Author: User

Oracle sequence Learning
 
I. Create a sequence
Create sequence [user.] <sequence Name>
Increment by <growth value>
Start with <start value>
[Maxvalue <maximum value> | nomaxvalue]
[Minvalue <Minimum value> | nominvalue]
[Nocycle]
 
<Growth value> it can be positive or negative, but cannot be 0. If this clause is not available, the default value is 1;
<Start value> is the first value of the sequence.
Maxvalue indicates the maximum value of a sequence. If nomaxvalue is used, the maximum value of an ascending sequence is 1027, and the maximum value of a descending sequence is-1.
Minvalue indicates the minimum value of the sequence. If nominvalue is used, the minimum value of the ascending sequence is 1, and the minimum value of the descending sequence is-1026.
Nocycle does not have a cycle, so it keeps accumulating
 
Ii. Change the sequence
Alter sequence [user.] <sequence Name>
[Increment by <growth value>]
[Maxvalue <maximum value> | nomaxvalue]
[Minvalue <Minimum value> | nominvalue]
 
You can modify the sequence to modify the increment of future sequence values.
Sets or removes the minimum or maximum value.
Change the number of buffer sequences.
Specify whether the serial number is ordered.
Note:
1. The first NEXTVAL returns the initial value.
2. You can alter all sequence parameters except start. If you want to change the start value, you must drop sequence and re-create.
 
Iii. Delete sequence commands
Drop sequence [user.] <sequence Name>
 
Deletes a sequence from a database.
 
 
Author: "To_Be_Monster_Of_IT"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.