Home » SQL & PL/SQL » SQL & PL/SQL » raise error propagation (oracle 11g2, windows os)
raise error propagation [message #611330] Tue, 01 April 2014 11:44 Go to next message
anncao
Messages: 87
Registered: August 2013
Member
I have a question about exception propogation. if I have cursor for loop, and in the loop there are two separate blocks with exeption, if anyone failed, I understand it will pass to the next outer transaction exeption, so I guess it is passed to the loop exeception,
and then it will pass to outmost exception.
Is that correct?
Create or replace myprocedure

as 

   cursor mycuror is 


    select ...

     from tableA join tableb on.

Begin

   for r in mycursor
   loop

   Begin  -- inner block1
    ....

   Exception
   when others then 
   logerror()
   raise;

   Begin   -- inner block 2
    ....

   Exception
   when others then 
   logerror()
   raise;
 End 

 some execution statement  -- does here have to be some execution command, can it be empty?

Exception   --loop exception
when others then 
  logerror()
raise;
End loop

some other command;

Exception   -- procedure outer exception
when others then 
 DBMS_OUTPUT.PUT_LINE (SQLCODE ||': '|| SQLERRM );
   logerror()
   raise;
End myprocedure;


*BlackSwan added {code} tags. Please do so yourself in the future.
Please read http://www.orafaq.com/forum/t/174502/102589/ to see how to do so.

[Updated on: Tue, 01 April 2014 12:06] by Moderator

Report message to a moderator

Re: raise error propagation [message #611335 is a reply to message #611330] Tue, 01 April 2014 12:07 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
what did you learn when you actually tested it?
Previous Topic: VIEW with Global Variables - help needed
Next Topic: Query that will compare two tables row by row and returns distinct rows from both tables
Goto Forum:
  


Current Time: Thu Apr 18 04:08:56 CDT 2024