get error message in stored procedure

Posted on 2009-02-23
Last Modified: 2013-12-09
I would like to insert SQL error message in a log table within a stored procedure.
For example, I would like to know which columns causes error -625, and I only know that the error message contains this piece of information :
Validation error for column @1, value "@2"

In other words, I need an equivalent of SQLERRM available in oracle PL/SQL.
Does such a thing exists in firebird ?


         /*functionnal code including inserts and updates which can cause errors to be trapped*/


         /*error handling section*/

             WHEN ANY DO


                vERR_MSG = ??????; --this is the place where I want to retrieve SQL message



                vERR_LANC = 1;



Open in new window

Question by:FVER
    LVL 19

    Accepted Solution

    first - no such ability exists
    second - even if it did the error would cause a rollback so the the insert of the log_table record would immediately be 'undone' so there would not be a record
    your application code needs to catch the exception and handle it, which can include an insert
    LVL 6

    Author Closing Comment

    There is no rollback if error is catched and not re raised as in the sample code included in the question.
    Thanks anyway, I'll stop wasting time on this subject.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now