FOR READ ONLY Clause
Use the FOR READ ONLY keywords to specify that the Select cursor declared for the SELECT statement is a read-only cursor. A read-only cursor is a cursor that cannot modify data.
Normally, you do not need to include the FOR READ ONLY clause in a SELECT statement. SELECT is a read-only operation by definition, so the FOR READ ONLY clause is usually unnecessary. In certain circumstances, however, you must include the FOR READ ONLY keywords in a SELECT statement.
If you attempt to include both the FOR READ ONLY clause and the FOR UPDATE clause in the same SELECT statement, the SELECT statement fails. For information on declaring a read-only cursor for a SELECT statement that does not include a FOR READ ONLY clause, see DECLARE statement.
EXEC SQL declare ansi_curs cursor for
select * from customer_ansi;
EXEC SQL declare ansi_read cursor for
select * from customer_ansi for read only;
DB-Access executes all SELECT statements with Select cursors, so you must specify FOR READ ONLY in all queries that access data in a read-only ANSI-compliant database. The FOR READ ONLY clause causes DB-Access to declare the cursor for the SELECT statement as a read-only cursor.
For more information on level-0 backups, see your Informix® Backup and Restore Guide. For more information on Select cursors, read-only cursors, and update cursors, see DECLARE statement.