| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Re: how to refresh a sequence
Robert Wehofer wrote:
> How could I refresh a sequence in Oracle using an SQL statement?
>
> I've got the problem, that the current number of a sequence is less
the
> highest index in a table, where I want to use the sequence.
>
> Regards,
> Robert
Either drop and recreate OR
declare
max_value_ number := <max value to increment to>;
currval_ number;
nextval_ number;
loop
select your_seq.currval into currval_ from dual;
if (currval_ >= max_value_) then
exit;
else
select your_seq.nextval into nextval_ from dual;
end if;
Regards
/Rauf
Received on Wed Feb 23 2005 - 03:49:06 CST
![]() |
![]() |