Je hebt geen dynamische SQL nodig.
begin
for i in (select sequence_name from dba_sequences where sequence_name like '%SEQ_PR%') LOOP
reset_seq(i.sequence_name); --> this is just fine
end loop;
end;
/
Voorbeeld (ik gebruik USER_SEQUENCES
in plaats daarvan):
SQL> select seq_pr1.nextval from dual;
NEXTVAL
----------
9
SQL> select seq_pr2.nextval from dual;
NEXTVAL
----------
8
SQL> begin
2 for i in (select sequence_name from user_sequences where sequence_name like '%SEQ_PR%') LOOP
3 reset_seq(i.sequence_name);
4 end loop;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> select seq_pr1.nextval from dual;
NEXTVAL
----------
1
SQL> select seq_pr2.nextval from dual;
NEXTVAL
----------
1
SQL>