Oracle Exception Handling Guide
In Oracle, exception handling code is typically written using the PL/SQL language. Here is an example:
DECLARE
v_num1 NUMBER := 10;
v_num2 NUMBER := 0;
v_result NUMBER;
BEGIN
v_result := v_num1 / v_num2;
DBMS_OUTPUT.PUT_LINE('Result: ' || v_result);
EXCEPTION
WHEN ZERO_DIVIDE THEN
DBMS_OUTPUT.PUT_LINE('Error: Division by zero');
END;
In the example above, a divide by zero exception will occur when v_num2 is 0, and the exception handling code will catch the exception and output an error message. Depending on specific needs, different exception handling code can be written to handle different exception cases.