Claus Pedersen
Member³
I have a sequence with next number 10 and want to change it to 20. I use the editor and press View SQL to view the SQL. I see the following:
Why do you have the PL/SQL code with the loop? It is because the sequence is defined with cache 20?
SQL:
alter sequence MY_SEQUENCE increment by 10 nocache;
select MY_SEQUENCE.nextval from dual;
alter sequence MY_SEQUENCE increment by 1 nocache;
declare
LastValue integer;
begin
loop
select MY_SEQUENCE.currval into LastValue from dual;
exit when LastValue >= 20 - 1;
select MY_SEQUENCE.nextval into LastValue from dual;
end loop;
end;
/
alter sequence MY_SEQUENCE increment by 1 cache 20;