批量查询序列代码的生成
用Execute Immediate ‘select sequence_name.nextval from dual ' 不能改变序列的当前值,必须通过
select sequence_name.nextval from dual;--来执行
获取当前用户下所有的序列并生成其select代码,如下
begin
--查询一边更改的序列,让序列增长上来
for rowsqltext in ( select 'select '|| SEQUENCE_NAME||'.nextval from dual;' as sqltext from USER_SEQUENCES ) loop
dbms_output.put_line(rowsqltext.sqltext);
begin
Execute Immediate 'select 1 from dual';
exception when others then
dbms_output.put_line(sqlerrm);
end;
end loop;
end;