简单匿名块的例子(循环隐式游标,动态执行sql),用于简单逻辑处理,入库更新等。
declare
cnt integer;begin
for cur in (select * from node_config@qcs where node_type='1') loop
select count(*) into cnt from (select distinct idcard from jmjbxxsjb a where communityid=cur.systemid and a.update_date>='201701');
execute immediate 'insert into t1_1 values(:1,:2)' using cur.systemid,cnt;
commit;
end loop;
end;
/