• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1099
  • Last Modified:

get error message in stored procedure

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

1 Solution
Nick UpsonPrincipal Operations EngineerCommented:
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
FVERAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now