Subject How to get SQL error message?
Author Nagy Szilveszter
Hi,


i have an SP which contains some EXECUTE STATEMENT commands.

I want to trap any possible errors these statements might generate, and save them into a log table, so i can analyze them later.


I only know how to get the error code (SQLCODE, GDSCODE) but i need the message too. In which system variable do i get the error?


my code looks like this


[...]

  WHEN ANY DO
  BEGIN
    EXECUTE PROCEDURE sys$log('Error: (SQLCODE= ' || SQLCODE || ')', 'ERR');
    EXCEPTION;
  END

[Non-text portions of this message have been removed]