You are on page 1of 23

a 



i   

Dealing with the Reality of Errors

u   
R R 
R 

R 
  R
  

 
| 

  
@ollow-up from this presentation

£ ºR       


  R  R
333     

£     RR !


  R  R" #

| 

  
Robust PL/SQL applications require....

£ M   R      R$


R  RRRR  
%
£ M #&R  # R$
    R 
#    %
£ '        (R
(# R    
Õ 3       
| 

  
So we will...


 )  #   R 
  RR 
R   
* R  RRRR  
   R 
+ ,     " 
  (    
  

| 

  
Different types of exceptions

£ ( 
 


  
   

    a a  
    a
£ ^   
 
 


 



   
  !"  #$%
#&' '#& a 

£ ^ 
 '((

  
  )
 

 
 * + +   
##,'-.#/!
| 

   a 


Õhat the Exception Section Covers

£ ,   R   #R   R


R   (R   ( 
 
+0
  



 
 
     
 
 1
 
  



 
ü 
 u   
 

 !

| 

  
Exceptions and DML

£ -R    R#`   ( 


   RR
  0   
   
 

£  ( R  
  



*2!3 +4
 

 
 
)



2 +4
 #
      (. + 0


 (
£ )  #  RR #   R
R  R  R R    
R  R    
| 

  
DBMS_UTILITY.@ RMAT_ERR R_BACKTRACE

Ñ    #Ñ u$Ñ

! 3%a    3 


 3  #Ñ u$Ñ

£ ü 
  "$  ##R  
  á`` #  .
£ ü-/^,"",01-M,/'/,M)2 #
R#    RR
 ' #   !3..,

  
  "3& &
  
| 

    


Strengths and weaknesses

 
' -  
  R3RRR

| 

  
PL/SQL error management strengths

£   R$# 


 &  R 
#  
 ' 0  ) 
 


0  ))
)  
£ 0  R  #R#R  
   R$( R #     R
 
)
.'!'**"' #..#.5) 

  


  6)

$ 7"* # 

| 

  

PL/SQL error management weaknesses

£ ,'4)',"5R   #  


 #  
)

 
  0 +)

8 



   

 - .'! 




  0 
 0
£ 5 # R #  RR(   R  
(R(#  
 -  
 
  


  


£ , R  R#&*6$777& &*6$666
| 

  
Shoring up the Õeaknesses

 8R    


 
     
  

| 

  
The Qnxo approach to error handling

£ (9 &R     


 # 9 7"* #   
 )


 )( 
(:
£ ü#RRR   R    (
 #
 
9     
;
 # 
  
£ # R  R
 R
 ,+
0 

 )


 
| 

  
bject-like representation of an exception

£ M R    ($  #


 ( R R # 
RR$ 
 &  05 


    6
 <  05)
 
 6
£ M R  R   
   
 '  
)

   

 




 ) 
)  
  
| 

  
ERD for error definition tables

| 

  
Specifying the error

j R "R:;
#    R<

=R R&*6666   <


     R
666 (R<
3 (    R R  (R<
3 (   `<

| 

  
Raise/handle errors by name or number

ü 
  !"#$
% 
&  
   
'()*+,- ./0##*1#"2.$3
  3

£ ,(    R  R 


 ( j&    (R
RRR
£ ) #$ R(  R  R  R$R
ü 
  !"#$
% 
&  
   

-$3
ü 
  3

| 

  
Stop-and-go programming

£ , #R 8   


    R8 
3  R  $  
 $" R 
 !
)
0 
0
 
+05




0
 
+06
 . 
+0  
0 +   
   

0/) :

| 

  
jow about "top-down" error definition?
ü 
  !"#$
% 
4"#
. 5
/ ''/6.
-#*78 .
& 5 .
-9#*78  ##$3
  3

£ ^R  : ;


   )
 
 

 


 
  
 
£ RRR  # R$       
> >
| 

  
Package to raise, handle and report errors

£       


   $ 
R  R ! # R
R$  
Õ% :#;#% 


 

& &Õ </ 3


#

& &&  5 </ 3


ü 
:#; -#$3
4"#
#78.  /'& ' 
6 .
-#*78.Õ .-9#*78 
-#(78.&  5 .-9#(78#
-#=78. ü
 5 .-9#=78.&  
 .$3
 3

| 

  

Runtime error gathering/construction

£ 3  R$#    


R      R RR(  
( R  RR
 
  
 0 
 =




 
0
£  R    
 
++

+5# >?0 6 

+ 
 5 #!
6
   



$    
$   


  
| 

   
Retrieve error information through the API

£  R     R      


 RR 
 )
 0 
+
 




 

 $*2!3
 


    0


 
 
  6 4";
:"6 4" :"
-#6 4" #
->6 4" #:#
-:"6 4" #::"
-#6 4" #:#
-:"#6 4" :"#
-#:?6 4" #:#:?
-:##:?6 4" #::##:?
-9;6 4" #:9;
$3

| 

  
Conclusions for PL/SQL error management

£ -R# R    R


 
 0 
 +

£  R R( # R   
 
9 

+ 
 0    

£ ^RRR     R
   0 
  
 )
£ 8        R  8R  
     
  
 
 
  




|