質問

I imported some data into my schema and I have one sequence for all my tables. In my old app, the sequence was around 1000, but this new sequence is starting at 4, and thus I am getting conflicts when trying to enter a new row. Is there a way to update the sequence or is there a way to set the sequence to a certain number during db creation? I don't mind doing a create-drop and importing the data again. I basically just want to set the sequence to start at 1000. Thanks.

役に立ちましたか?

解決

You should be able to increase the increment, access the sequence and then reset the increment, e.g.:

alter sequence [sequence name]
increment by [desired value minus current value];

select [sequence name].nextval from dual;

alter sequence [sequence name]
increment by 1;

I got this syntax from: http://www.techonthenet.com/oracle/sequences.php

他のヒント

You can always set up the start number of the sequence when creating it:

CREATE SEQUENCE my_sequence
    MINVALUE 1000
    START WITH 1000
    INCREMENT BY 1;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top