If you cannot figure out how to use direct SQL (avoiding the for loop all together), you can probably improve performance using the BULK Collection pl / sql functions.
Sample article here.
Syntax excerpt
LOOP FETCH c_orders BULK COLLECT INTO v_order_ids, v_currency_codes, v_amounts_local LIMIT 100; EXIT WHEN v_row_count = c_orders%ROWCOUNT; v_row_count := c_orders%ROWCOUNT; FOR i IN 1..v_order_ids.count LOOP v_amounts_usd(i) := currency_convert (v_amounts_local(i), v_currency_codes(i)); END LOOP; FORALL i IN 1..v_order_ids.count UPDATE open_orders SET amount_usd = v_amounts_usd(i) WHERE order_id = v_order_ids(i); END LOOP;
source share