Manually forward a sequence - oracle sql -
i need forward set of sequences dml access. due bug in piece of code several values grabbed without sequence instead manually, sequence duplicating values. so, push sequence max value next time nextval called, gives value higher maximum. i've got 50 sequences each have go few thousand forward.
is possible dml access? if so, how should go it?
you can use dynamic sql this. example, bit of code select next 10,000 values each of list of sequences.
declare l_num integer; begin seq in (select * all_sequences sequence_name in (<<list of 50 sequences>>) , sequence_owner = <<owner of sequences>>) loop in 1 .. 10000 loop execute immediate 'select ' || seq.sequence_owner || '.' || seq.sequence_name || '.nextval dual' l_num; end loop; end loop; end;
if had ability issue ddl against sequence, use similar approach set increment
10,000, select 1 value sequence, , set increment
down 1 (or whatever now).
Comments
Post a Comment