Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Help! Declare pragma autonomous_transaction

User_VU936Oct 12 2021

Hi,
I've picked up some code from a colleague and am struggling to understand his use of pragma autonomous_transaction and it's relation with cursor/ loop and bulk collect functions.
I'm really just looking for someone to point me in the right direction in regards to what he may have been trying to achieve in writing this script. And if anyone is able to provide some basic, top level description of these functions that would be helpful.

--The script begins with --
declare
pragma autonomous_transaction;
cursor cus_det1 is
select* from jc_fscs_run_seq2_1;
type num10 is table of number(10);
l_cust_no1 num10;
l_cust_no2 num10;
limit_in number := 1;
begin
open cus_det1;
loop
fetch cus_det1 bulk collect into l_cust_no1, l_cust_no2 limit limit_in;

---and the script ends with --

commit;

  exit when l\_cust\_no1.count \< limit\_in;  
  end loop;  
  close cus\_det1;  

end;
Appreciate this isn't much information to go off but only looking for some basic understanding of these functions.
Thanks,
D

Comments
Post Details
Added on Oct 12 2021
10 comments
396 views