Resets the oracle sequence from a specified number.

Source: Internet
Author: User


Resets the oracle sequence from the specified number. The SQL code www.2cto.com declare n number (10); v_startnum number (10): = 10000001; -- the number of v_step numbers (10): = 1; -- step tsql varchar2 (200); v_seqname varchar2 (200): = 'mip _ JF_SEQUENCE '; -- sequence name begin execute immediate 'select' | v_seqname | '. nextval from dual 'into n; n: = v_startnum-n-v_step; -- Starting from 10000001 tsql: = 'alter sequence '| v_seqname | 'increment by' | n; execute immediate tsql; execute immediate 'select' | v_seqname | '. nextval from dual 'into n; tsql: = 'alter sequence '| v_seqname | 'increment by' | v_step; execute immediate tsql; end ;/
 

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.