Oracle Sequence Modification

Source: Internet
Author: User
Tags sql error

During project creation, Oracle database migration may occur, and the sequence may be reset. As a result, when the current value of the sequence is smaller than the maximum value of the field in the table using the sequence, an error occurs,

[DH-OFFICE] 19:48:32 warn [http-8080-5] jdbcexceptionreporter. logexceptions (100) | SQL error: 1, sqlstate: 23000 [DH-OFFICE] 19:48:32 error [http-8080-5] jdbcexceptionreporter. loghoptions (101) | ORA-00001: violates a unique constraint (dhoffice. pk_app_user)

Modify the sequence value:

Maximum query value

Select max (userid) from userinfo

Add 100 to the original maximum value
Alter sequence s_app_user increment by 100;

Done!

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.