Thursday, August 25, 2005

PL/SQL Exceptions Summary

DECLARE  
  PARENT_KEY_NOT_FOUND exception;  
  PRAGMA EXCEPTION_INIT(PARENT_KEY_NOT_FOUND,-2291);
BEGIN  
  ...sql code...  
  BEGIN      
    ... insert into a table with foreign key constraints ...  
  EXCEPTION      
    WHEN PARENT_KEY_NOT_FOUND THEN        
       ...handle it here...
       RAISE; -- raise it again--  
  END;
EXCEPTION  
  WHEN OTHERS THEN      
    ...trap it here again...
END;
/

0 Comments:

Post a Comment

<< Home