In the page:
http://www.firebirdsql.org/refdocs/langrefupd25-sqlstate.html
there is an example of the use of SQLSTATE, however it doesnt work. When I
try that code the message: "Unknown variable - SQLSTATE" is showed.
I had declared the variable MSG as VARCHAR(1024) and the exception
EX_CUSTOM as usual, with the 'Error:' word.
However, if I write:
WHEN ANY DO BEGIN
IN AUTONOMOUS TRANSACTION DO
INSERT INTO LOG (LOG_COMENT) VALUES (SQLSTATE);
END
it works fine and I can insert the value of SQLSTATE into the table LOG.
Also, if I write:
WHEN ANY DO BEGIN
IF (SQLSTATE = '42S01') THEN
MSG = 'Table exists';
END
the same message: "Unknown variable - SQLSTATE" is showed.
I am using Windows 7 Ultimate, Firebird 2.5.2, SuperServer.
Any idea? Why SQLSTATE sometimes is an unknown variable inside WHEN ANY?
Greetings.
Walter.