FirebirdSQL logo

CURRENT_USER

Name of the user of the current connection

Type

VARCHAR(63)

Syntax
CURRENT_USER

CURRENT_USER is equivalent to [fblangref50-contextvars-user].

Example
create trigger bi_customers for customers before insert as
begin
    New.added_by  = CURRENT_USER;
    New.purchases = 0;
end

DELETING

Indicates if the trigger fired for a DELETE operation

Available in

PSQL — DML triggers only

Type

BOOLEAN

Syntax
DELETING

Intended for use in multi-action triggers.

Example
if (deleting) then
begin
  insert into Removed_Cars (id, make, model, removed)
    values (old.id, old.make, old.model, current_timestamp);
end

GDSCODE

Firebird error code of the error in a WHEN …​ DO block

Available in

PSQL

Type

INTEGER

Syntax
GDSCODE

In a “WHEN …​ DO” error handling block, the GDSCODE context variable contains the numeric value of the current Firebird error code.GDSCODE is non-zero in WHEN …​ DO blocks, if the current error has 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