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

--创建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 loop
BEGIN
INSERT 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

你可能感兴趣的:(ORACLE存储过程的游标和for循环)