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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The same call in ESQL (with obligatory colons):<br />

DML statements<br />

exec sql<br />

execute procedure MakeFullName<br />

:FirstName, :MiddleName, :LastName<br />

returning_values :FullName;<br />

...and in <strong>Firebird</strong>'s command-line utility isql (with literal parameters):<br />

execute procedure MakeFullName<br />

'J', 'Edgar', 'Hoover';<br />

Note: In isql, don't use RETURNING_VALUES. Any output values are shown automatically.<br />

Finally, a PSQL example with expression parameters, only possible in <strong>Firebird</strong> 1.5 and up:<br />

execute procedure MakeFullName<br />

'Mr./Mrs. ' || FirstName, MiddleName, upper(LastName)<br />

returning_values FullName;<br />

Available in: DSQL, ESQL, PSQL<br />

INSERT<br />

Description: Adds rows to a database table, or to one or more tables underlying a view. Field values can be<br />

given in the VALUES clause, they can be totally absent (in both cases, exactly one row is inserted), or they can<br />

come from a SELECT statement (0 to many rows inserted).<br />

Syntax:<br />

INSERT [TRANSACTION name]<br />

INTO {tablename | viewname}<br />

{DEFAULT VALUES | [()] }<br />

[RETURNING [INTO ]]<br />

::= colname [, colname ...]<br />

::= VALUES () | <br />

::= value [, value ...]<br />

::= :varname [, :varname ...]<br />

::= a SELECT whose result set fits the target columns<br />

Restrictions<br />

• The TRANSACTION directive is only available in ESQL.<br />

• The RETURNING clause is not available in ESQL.<br />

• The “INTO ” subclause is only available in PSQL.<br />

• When returning values into the context variable NEW, this name must not be preceded by a<br />

colon (“:”).<br />

• Since v. 2.0, no column may appear more than once in the insert list.<br />

63

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

Saved successfully!

Ooh no, something went wrong!