-- 声明一个游标,查询表
CURSOR c1 IS
SELECT empno, ename FROM emp ;
BEGIN
--游标循环,通过ee变量获取记录的,如ee.empno,ee.ename
FOR ee IN c1 LOOP
--循环调用insert into 。
insert into ttt values(ee.empno,ee.ename);
END LOOP;
COMMIT;
END; ------其他解决方案-------------------- 游标可以传参数的。如
CURSOR c1(name) IS
SELECT empno, ename FROM emp where ename=name
使用时,传入参数,如
FOR ee IN c1('hh') LOOP ------其他解决方案--------------------
JUST LIKE THIS。
TYPE fieldType IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
V_DEALERGUID fieldType;
begin
--获取所有接收人GUID
SELECT * BULK COLLECT INTO V_DEALERGUID from table(FT_SPLIT(V_WORKORDERCYCLE.F_DEALER_IDS,','));
end;