Chapter 5
|
Supported standards 31
FOR UPDATE clause
The FOR UPDATE clause performs 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.
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
Additional examples:
Notes from the examples
A column is a reference to a field in the FileMaker database file (the field can contain many distinct values).
The asterisk (*) wildcard character is shorthand for “everything”. For the example SELECT * FROM
Salespeople
, the result is all the rows in the Salespeople table. For the example SELECT DISTINCT
* FROM Salespeople
, the result is all the unique rows in the Salespeople table (no duplicates).
Note SELECT * statements on larger databases might not function correctly. To avoid potential confusion,
avoid wildcards and specify table and column names (without aliases).
Using Sample SQL
text constant SELECT 'CatDog' FROM Salespeople
numeric constant SELECT 999 FROM Salespeople
date constant SELECT DATE '2004-06-05' FROM Salespeople
time constant SELECT TIME '02:49:03' FROM Salespeople
timestamp constant SELECT TIMESTAMP '2004-06-05 02:49:03' FROM Salespeople
text column SELECT Company_Name FROM Sales_Data
SELECT DISTINCT Company_Name FROM Sales_Data
numeric column SELECT Amount FROM Sales_Data
SELECT DISTINCT Amount FROM Sales_Data
date column SELECT Date_Sold FROM Sales_Data
SELECT DISTINCT Date_Sold FROM Sales_Data
time column SELECT Time_Sold FROM Sales_Data
SELECT DISTINCT Time_Sold FROM Sales_Data
timestamp column SELECT Timestamp_Sold FROM Sales_Data
SELECT DISTINCT Timestamp_Sold FROM Sales_Data
BLOB
a
column
a. A BLOB is a FileMaker database file container field.
SELECT Company_Brochures FROM Sales_Data
SELECT GETAS(Company_Logo, 'JPEG') FROM Sales_Data
Wildcard * SELECT * FROM Salespeople
SELECT DISTINCT * FROM Salespeople