To gain a better understanding of how exceptions behave, you can explicitly cause an exception to occur by creating code that will compile but raise an exception at runtime.
DECLARE x NUMBER; BEGIN dbms_output.put_line('Starting...'); x := 1 / 0; dbms_output.put_line('...Ending'); END;
In this example an error occurs because of an attempt to divide by zero:
ORA-01476: divisor is equal to zero
Oracle includes object names, numbers, and character strings in messages. When dealing with PL/SQL objects, a message stack includes additional information, such as the line number where the error occurred. In order to quickly track down errors, make sure to have line numbers displayed in your editor.