You need to trap exceptions and provide a useful handler. Perhaps something like the following:
BEGIN
INSERT INTO SOME_TABLE (A_COLUMN) VALUES ('XYZ');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error: ' || SQLCODE || ':' || SQLERRM);
RAISE;
END;
The exception handler begins with the line containing EXCEPTION
.
There are many pre-defined exceptions that either you or the Oracle system can raise, and you can define your own exceptions and use them. The link given in the comment above should be helpful in understanding this concept.
Share and enjoy.