question

sqlnewb avatar image
sqlnewb asked

Catching Exceptions

How would I go about catching this error before it got to the when others clause? I KNOW I NEED TO WRAP THE INNER BLOCK WITH A BEGIN AND END BUT I THINK I AM PUTTIN ONE OF THE BEGIN IN THE WRONG PLACE Using oracle CREATE OR REPLACE PROCEDURE example1 ( p_first_name IN varchar2) as v_test_variable varchar(4) := p_first_name; BEGIN BEGIN DBMS_OUTPUT.PUT_LINE('Exception Propagation Example 1'); EXCEPTION when others then DBMS_OUTPUT.PUT_LINE('An error occured in the declaration section '); END ; EXCEPTION WHEN value_error THEN DBMS_OUTPUT.PUT_LINE('You cant put ['||V_TEST_VARIABLE || '] in a 4 character string.'); END example1; / show errors EXEC EXAMPLE1('hello')
stored-proceduresoracleexception
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.