raise error propagation [message #611330] |
Tue, 01 April 2014 11:44 |
|
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
|
|
|
|