SQL Reference
Table Of Contents
Chapter 2 | Supported standards 14
To return the ten rows and their peer rows (rows that are not distinct based on the ORDER BY
clause):
SELECT emp_id, last_name, first_name FROM emp ORDER BY last_name,
first_name OFFSET 25 ROWS FETCH FIRST 10 ROWS WITH TIES
FOR UPDATE clause
The FOR UPDATE clause locks records for Positioned Updates or Positioned Deletes via SQL
cursors. The format is:
FOR UPDATE [OF column_expressions]
column_expressions is a list of field names in the database table that you intend to update,
separated by a comma. column_expressions is optional, and is ignored.
Example
The following example returns all records in the employee database that have a SALARY field
value of more than $20,000. When each record is fetched, it is locked. If the record is updated or
deleted, the lock is held until you commit the change. Otherwise, the lock is released when you
fetch the next record.
SELECT * FROM emp WHERE salary > 20000
FOR UPDATE OF last_name, first_name, salary