我有以下代码,它循环遍历一个 oracle 表单块,然后将其与游标中的数据进行比较(游标从块本身获取数据)。由于三个循环,性能非常糟糕,并且随着大量记录呈指数增长。关于如何改进它的任何建议?
loop
if :PAYMENTS_COLLECTIONS.CHECK_BOX='Y' then
temp_rec := :system.cursor_record;
acc_payment_no1 := :payments_collections.acc_payment_numb;
for pay_same_trans in payments_in_same_trans(:payments_collections.acc_payment_numb)
loop
first_record;
acc_payment_no2 := pay_same_trans.acc_payment_no;
REMOVE_PAID_TRANSACTION(pay_same_trans.payment_trans_seq_no);
loop
if pay_same_trans.acc_payment_no = :PAYMENTS_COLLECTIONS.acc_payment_numb and :PAYMENTS_COLLECTIONS.CHECK_BOX='Y' then
receipt_selected := true;
exit;
end if;
if :system.last_record = 'TRUE' then
exit;
end if;
next_record;
end loop;
if receipt_selected = false then
raise not_reverting_whole_trans;
end if;
receipt_selected := false;
end loop;
go_record(temp_rec);
end if;
if :system.last_record = 'TRUE' then
exit;
end if;
next_record;
end loop;