12

oracle简单匿名块的例子(循环隐式游标,动态执行sql)

2017-03-30 09:52:00    1147533288    2331    原创

简单匿名块的例子(循环隐式游标,动态执行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;
/
苏ICP备18038013号-1
蝉知 蝉知5.2