11.9 GDSCODE
Available inPSQL
TypeINTEGER
Syntax
GDSCODE
In a WHEN … DO
error handling block, the GDSCODE
context variable contains the numerical representation of the current Firebird error code. Prior to Firebird 2.0, GDSCODE
was only set in WHEN GDSCODE
handlers. Now it may also be non-zero in WHEN ANY
, WHEN SQLCODE
, WHEN SQLSTATE
and WHEN EXCEPTION
blocks, provided that the condition raising the error corresponds with a Firebird error code. Outside error handlers, GDSCODE
is always 0. Outside PSQL, it doesn’t exist at all.
Note
After WHEN GDSCODE
, you must use symbolic names like grant_obj_notfound
etc. But the GDSCODE
context variable is an INTEGER
. If you want to compare it against a specific error, the numeric value must be used, e.g. 335544551
for grant_obj_notfound
.
Example
when gdscode grant_obj_notfound, gdscode grant_fld_notfound,
gdscode grant_nopriv, gdscode grant_nopriv_on_base
do
begin
execute procedure log_grant_error(gdscode);
exit;
end