Firebird 2.1 Language Reference Update
Firebird 2.1 Language Reference Update
Firebird 2.1 Language Reference Update
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
DML statements<br />
Description: Limits the amount of rows updated to a specified number or range.<br />
Syntax:<br />
ROWS [TO ]<br />
, ::= Any expression evaluating to an integer.<br />
With a single argument m, the update is limited to the first m rows of the dataset defined by the table or view<br />
and the optional WHERE and ORDER BY clauses.<br />
Points to note:<br />
• If m > the total number of rows in the dataset, the entire set is updated.<br />
• If m = 0, no rows are updated.<br />
• If m < 0, an error is raised.<br />
With two arguments m and n, the update is limited to rows m to n inclusively. Row numbers are 1-based.<br />
Points to note when using two arguments:<br />
• If m > the total number of rows in the dataset, no rows are updated.<br />
• If m lies within the set but n doesn't, the rows from m to the end of the set are updated.<br />
• If m < 1 or n < 1, an error is raised.<br />
• If n = m-1, no rows are updated.<br />
• If n < m-1, an error is raised.<br />
ROWS can also be used with the SELECT and DELETE statements.<br />
Available in: DSQL, PSQL<br />
Added in: <strong>2.1</strong><br />
UPDATE OR INSERT<br />
Description: UPDATE OR INSERT checks if any existing records already contain the new values supplied for<br />
the MATCHING columns. If so, those records are updated. If not, a new record is inserted. In the absence of a<br />
MATCHING clause, matching is done against the primary key. If a RETURNING clause is present and more than<br />
one matching record is found, an error is raised.<br />
Syntax:<br />
UPDATE OR INSERT INTO<br />
{tablename | viewname} [()]<br />
VALUES ()<br />
[MATCHING ()]<br />
[RETURNING [INTO ]]<br />
::= colname [, colname ...]<br />
::= value [, value ...]<br />
::= :varname [, :varname ...]<br />
87