Auto-incrementing sequence and stored procedure in Oracle

Source: Internet
Author: User

Auto-incrementing sequence and stored procedure in Oracle

Oracle does not have auto-increment columns. In this case, you must manually write a method or use a sequence or trigger.

Easy to use (personal habits)

1. create sequence salary_seq
2.
3. increment by 1 --- add several
4.
5. start with 1 -- count from 1
6.
7. nonmaxvalue -- do not set the maximum value
8.
9. nocycle -- always accumulate without repeating
10.
11. cache 10 -- there is a buffer
12.
13.
14.
15. eg create sequence salary_seq
16.
17. Min value 100
18.
19. max value 9999999999
20.
21. start with 560
22.
23. increment by 1
24.
25. cache 20;
26.
27.
28.
29. using: insert into tableName value (salary_seq.nextval ,'','');

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.