Oracle sequence creation and function ____oracle

Source: Internet
Author: User
Tags numeric value

1. Create:

CREATE SEQUENCE emp_sequence  --sequence name
INCREMENT by 1-   -if omitted, the default is 1, and if negative, the value of the sequence is decremented by this step. Start 
with 1       -counting the Nomaxvalue from 1-        without setting the maximum nocycle-is               cumulative and does not cycle  
CACHE;  --cache (buffering) defines the size of the memory block that holds the sequence, and defaults to 20.

2. Modify:

ALTER SEQUENCE sequence name
[INCREMENT by n]
[{maxvalue/minvalue n| Nomaxvalue}]
[{cycle| Nocycle}]
[{CACHE n| NoCache}];

* Cannot modify the initial value of the sequence

3. Delete

DROP SEQUENCE sequence name;

4. View all sequences

Select Sequence_name from Dba_sequences

SELECT * FROM User_sequences

5. Features:

is a database object provided by Oacle to produce a series of unique numbers.

L provide a unique numeric value automatically

L Shared objects

L primarily used to provide primary key values

L Loading sequence values into memory can improve access efficiency

Related Article

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.