Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateContext variables → GDSCODE
Firebird Home Firebird Home Prev: DELETINGFirebird Documentation IndexUp: Context variablesNext: INSERTING

GDSCODE

Tip

Find a more recent version at Firebird 5.0 Language Reference: GDSCODE

Available in: PSQL

Added in: 1.5

Description: In a WHEN GDSCODE handling block, the GDSCODE context variable contains a numerical representation of the current Firebird error code. It is 0 in WHEN SQLCODE, WHEN EXCEPTION and WHEN ANY handlers, as well as everywhere else in PSQL.

Type: INTEGER

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

Please notice: 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 certain error, you have to use the numeric value, e.g. 335544551 for grant_obj_notfound.

Prev: DELETINGFirebird Documentation IndexUp: Context variablesNext: INSERTING
Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateContext variables → GDSCODE