ORACLE存储过程的游标和for循环

来源:互联网 发布:js中的length 编辑:程序博客网 时间:2024/05/16 08:19
--创建test存储过程
create or replace procedure test as --建立游标   Cursor ss is select CALL_OBJ from MONITOR_LOG group by CALL_OBJ;BEGIN
--for循环(遍历游标)for b in ss loopBEGININSERT INTO AA(hongyan) SELECT count(SERIAL_NUM) FROM monitor_log t WHERE t.call_obj = b.call_obj;COMMIT;end;END loop;END;

注意:建立游标ss,以集合的方式存储数据;for循环中赋值b.call_obj

0 0
原创粉丝点击