Oracle sequence creation and cyclic auto-increment values

Source: Internet
Author: User

Use sys to log on to Oracle SQL> conn sys/root as sysdba for sequence creation and auto-increment of loops; create sequence SQL> create sequence test_seq maxvalue 9 increment by 2 start with 1 cache 2 cycle; create corresponding test table SQL> create table test_table (next number, curr number ); insert test data (10 times in a loop) SQL> insert into test_table (next, curr) values (test_seq.nextval, test_seq.currval); Retrieve Data: SQL> select * from testseq1; next curr ---------- 1 1 3 3 5 5 7 7 9 9 11 11 13 13 15 17 17 19 19

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.