The first time you find a row you would insert, you get a no_data_found, which jumps out of the loop, raises your g_end_program exception, which is not handled, so it dies.
Try something like:Code:. . . BEGIN FOR cr IN reqs LOOP BEGIN SELECT request_id INTO l_request_id FROM table_B WHERE request_id = cr.request_id; EXCEPTION when no_data_found then INSERT INTO table_B from cursor.... END; END LOOP; COMMIT; ? ? ? END; /




Reply With Quote