--
-- ### nested procedure exception
-- 
--

drop if exists procedure excepCheck004; 
@ 
create procedure excepCheck004 ( i in int, r out string(20) ) return int 
begin 
   if :i = 1 
   then 
     begin 
       throw 'A nested exception ..'; 
     exception when other 
     then 
       :r = 'Exception for 1'; 
     end; 
   else 
     throw 'Ouups, an exception in the else path ..'; 
   end; 
   return 0; 
exception when other 
then 
   :r = :excep_info; 
   return 1; 
end; 
@ 

:r = call excepCheck004(1, :s); 
print :r; 
print :s; 
:r = call excepCheck004(2, :s); 
print :r; 
print :s;

