Could somebody please confirm for me that if I'm running a PLSQL script containing multiple blocks of code and I capture an error - does using the 'RAISE' command on it's own skip through to the exception handling at the end of the script or will it continue to run through the remaining blocks of code? Alternatively if I raise the exeception using 'RAISE handle_tns_error' where handle_tns_error is defined as an exception and also listed in the exception section at the end (as in the example below), will that skip past all other blocks in the code and exit immediately with an error? Thank you.
.
.
.
ELSIF SQLCODE = -12154 THEN
DBMS_OUTPUT.PUT_LINE('Detected a TNS error');
RAISE handle_tns_error;
ELSE
RAISE;
END IF;
END;
<all code here will be ignored>
EXCEPTION
WHEN handle_tns_error THEN
DBMS_OUTPUT.PUT_LINE('tns error detected');
:ret_code := 1;
WHEN OTHERS THEN RAISE;
END;
/
handle_tns_error
seems an odd name for an exception. We don't havehandle_no_data_found
orhandle_too_many_rows
. Handling is what the code does with the exception. The exception isn't its own handler.