About sequence [message #21265] |
Mon, 22 July 2002 01:21 |
Jore
Messages: 1 Registered: July 2002
|
Junior Member |
|
|
Hello everyone,
The last sequence no in one table is 106 which can be seen in the sequence table, but the last record's id is 116, so when i add new record, the error say "Villate Unique constraint". How to solve this problem? I had tried to modify the sequence last no., but failed.
|
|
|
Re: About sequence [message #21266 is a reply to message #21265] |
Mon, 22 July 2002 10:18 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Here's a block you can run to bump the sequence up so the next value selected from it will not cause a constraint violation on the insert:
declare
x number;
begin
loop
select seq.nextval into x from dual;
select seq.currval into x from dual;
exit when x >= 116;
end loop;
end;
|
|
|