DISQUS

Eddie Awad’s Blog: Little known way to get the error message in PL/SQL

  • Matt Symes · 1 year ago
    I think this article misses the real difference between SQLERRM and FORMAT_ERROR_STACK.

    The latter returns the entire error stack (the clue is in the name). Sometimes the real error you want to identify is some way down the error stack - in which case SQLERRM is no good for you.

    If looking for a particular error number in FORMAT_ERROR_STACK you can simply do a:

    EXCEPTION
    WHEN OTHERS THEN
    IF INSTR(dbms_utility.format_error_stack, 'ORA-12345') != 0 THEN ...
    ELSE
    RAISE;
    END;
  • Matt Symes · 1 year ago
    That should, of course, have ended with

    ELSE
    RAISE;
    END IF;
    END;
  • Guillaume · 1 year ago
    Does anyone of you knows how to do the same in c.
    You pass an error code and you get the message like perror in Unix.

    Thanks
  • Eddie Awad · 1 year ago
    @Matt Good point. Thanks for the tip.

    @Guillaume I'm afraid I cannot help you with C.
  • Anjali · 1 year ago
    hi
    i am preparing for job interviews as a pl/sql developer.
    where can i find good interview questions on database triggers and cursors.
    ne pointers to tat plzzz