1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| i:=0;
select count(*) into i from my_table;
if i=0 then
insert into my_table select co.co_id,0 AS status FROM CONTRACT_ALL co WHERE .... and ROWNUM < 10 order by co.co_id;
.
--COMMIT;
end if;
SELECT COUNT(1) INTO i FROM my_table WHERE status=0;
IF i > 0 THEN
WHILE performed LOOP
performed :=FALSE;
SELECT * BULK COLLECT INTO my_cache FROM my_table WHERE status = 0 AND ROWNUM<5;
if my_cache.count > 0 then
DBMS_OUTPUT.PUT_LINE('Count my_cache :'|| my_cache.count);
FOR l_row IN my_cache.FIRST .. my_cache.LAST
LOOP
performed := TRUE;
--SAVEPOINT P1;
BEGIN
v_co_id := my_cache(l_row).co_id;
/*
return_code := appel_function;
IF return_code!=2 THEN
ROLLBACK TO P1;
END IF;*/
END;
END LOOP;
--COMMIT;
end if;
END LOOP; |