21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Available in: PSQL<br />

Added in: 1.5<br />

Context variables<br />

SQLCODE<br />

Description: In a WHEN SQLCODE handling block, the SQLCODE context variable contains the current SQL<br />

error code. The same is true in a WHEN ANY block if its execution was triggered by an SQL error; otherwise<br />

it contains 0. SQLCODE is also 0 in WHEN GDSCODE and WHEN EXCEPTION handlers, as well as everywhere<br />

else in PSQL.<br />

Type: INTEGER<br />

Example:<br />

when any<br />

do<br />

begin<br />

if (sqlcode 0) then<br />

Msg = 'An SQL error occurred!';<br />

else<br />

Msg = 'Something bad happened!';<br />

exception ex_custom Msg;<br />

end<br />

Available in: PSQL<br />

Added in: 1.5<br />

UPDATING<br />

Description: Available in triggers only, UPDATING indicates if the trigger fired because of an UPDATE operation.<br />

Intended for use in multi-action triggers.<br />

Type: boolean<br />

Example:<br />

if (inserting or updating) then<br />

begin<br />

if (new.serial_num is null) then<br />

new.serial_num = gen_id(gen_serials, 1);<br />

end<br />

116

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!