SQLCODE
SQLCODE of the Firebird error in a WHEN … DO block
PSQL
2.5.1
INTEGER
SQLCODE
In a “WHEN … DO” error handling block, the SQLCODE context variable contains the numeric value of the current SQL error code.SQLCODE is non-zero in WHEN … DO blocks, if the current error has a SQL error code.Outside error handlers, SQLCODE is always 0.Outside PSQL, it doesn’t exist at all.
|
Warning
|
|
when any
do
begin
if (sqlcode <> 0) then
Msg = 'An SQL error occurred!';
else
Msg = 'Something bad happened!';
exception ex_custom Msg;
end