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.

DML statements<br />

Description: If you give a table or view an alias in a <strong>Firebird</strong> 2.0 or above statement, you must use the alias, not<br />

the table name, if you want to qualify fields from that relation.<br />

Examples:<br />

Correct usage:<br />

update Fruit set soort = 'pisang' where ...<br />

update Fruit set Fruit.soort = 'pisang' where ...<br />

update Fruit F set soort = 'pisang' where ...<br />

update Fruit F set F.soort = 'pisang' where ...<br />

No longer possible:<br />

update Fruit F set Fruit.soort = 'pisang' where ...<br />

RETURNING<br />

Available in: DSQL, PSQL<br />

Added in: <strong>2.1</strong><br />

Description: An UPDATE statement modifying at most one row may optionally include a RETURNING clause<br />

in order to return values from the updated row. The clause, if present, need not contain all the modified columns<br />

and may also contain other columns or expressions. The returned values reflect any changes that may have been<br />

made in BEFORE tiggers, but not those in AFTER triggers. OLD.fieldname and NEW.fieldname may both be<br />

used in the list of columns to return; for field names not preceded by either of these, the new value is returned.<br />

Example:<br />

Notes:<br />

update Scholars<br />

set firstname = 'Hugh', lastname = 'Pickering'<br />

where firstname = 'Henry' and lastname = 'Higgins'<br />

returning id, old.lastname, new.lastname<br />

• In DSQL, a statement with a RETURNING clause always returns exactly one row. If no record was actually<br />

updated, the fields in this row are all NULL. This behaviour may change in a later version of <strong>Firebird</strong>. In<br />

PSQL, if no row was updated, nothing is returned, and the receiving variables keep their existing values.<br />

ROWS<br />

Available in: DSQL, PSQL<br />

Added in: 2.0<br />

86

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

Saved successfully!

Ooh no, something went wrong!