Sequence operations in Oracle and prior sequence Initialization

Source: Internet
Author: User


Sequence operations in Oracle and use the previous initialization of sequence 1 create sequence myseqstart with 1 increment by 1 nomaxvalueminvalue 1 II Initialize sequence select myseq. nextval from dual; it is worth noting that if you write select myseq directly first. currval from dual, will prompt myseq. currtval has not been defined in this session. Www.2cto.com 3 can be used only after the sequence is initialized. We use ibatis as an example. <Insert id = "insert" parameterClass = "Student"> <selectKey resultClass = "String" keyProperty = "mid"> select myseq. nextval from dual </selectKey> <! [CDATA [insert into Student (id, name, age) values (# mid #, # mname #, # mage #)]> </insert> www.2cto.com when you modify a sequence, you cannot modify the following values: 1. You cannot modify the initial value of the sequence. 2. The minimum value of the sequence cannot be greater than the current value (currval) 3. the maximum value of the sequence cannot be smaller than the current value (currval) alter sequence myseqincrement by 2. Five. Delete the sequence drop sequence myseq author woshixuye.

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.