Search This Blog

How do you handle exceptions and errors in stored procedures?

exceptions can be handled in various ways in the stored procedures. Method (1) could be using EXCEPTION block in the procedure within which use WHEN THEN. Method (2) could be declare a variable in DECLARE section as EXCEPTION type, raise it wherever required using RAISE and handle it in EXCEPTION part using WHEN clause. Method (3) could be using the keywords SQLCODE & SQLERRM to display error no and error code..