| Firebird Documentation Index → Firebird 1.5 Language Ref. Update → Context variables → SQLCODE |
![]() |
Available in: PSQL
Added in: 1.5
Description: In a WHEN SQLCODE handling block, the SQLCODE context variable contains the current SQL error code. In a WHEN ANY block it contains the SQL error code if indeed an SQL error occurred; otherwise it contains 0. SQLCODE is also 0 in WHEN GDSCODE and WHEN EXCEPTION handlers, as well as everywhere else in PSQL.
Type: INTEGER
Example:
when any
do
begin
if (sqlcode <> 0) then
Msg = 'An SQL error occurred!';
else
Msg = 'Something bad happened!';
exception ex_custom Msg;
end
| Firebird Documentation Index → Firebird 1.5 Language Ref. Update → Context variables → SQLCODE |