oracle exception handling
Filed Under (Others) by admin on 03-07-2009
Been having Stored Procedures problems on oracle lately keeps on getting errors, and its really hard to trace, especially when u don’t know where to start. good thing exception handling comes handy on oracle, here’s what I usually do to raise exceptions.
CREATE OR REPLACE PROCEDURE myproc IS
BEGIN
NULL; — do something here insert or update
EXCEPTION
WHEN OTHERS THEN
emesg := SQLERRM;
dbms_output.put_line(emesg);
END;
**************************************************************************************
The code is basic put he EXCEPTION on the end just beofre the end; then put
EXCEPTION
WHEN OTHERS THEN
emesg := SQLERRM;
dbms_output.put_line(emesg);
this means that any instance there is an exception pass the SQLERRM, the sql error message toemesg and print it using dbms_output.put_line
that is you simple and quick exception handing ang prblem tracing
more exception handling techniques available here http://www.psoug.org/reference/exception_handling.html


