AppendForFetchOnly CLI/ODBC and IBM data server driver configuration keyword

Specifies whether the clause FOR FETCH ONLY is appended to READ-ONLY SQL statements.

db2cli.ini keyword syntax:
AppendForFetchOnly = 0 | 1
IBM® data server driver configuration file (db2dsdriver.cfg) syntax;
<parameter name="AppendForFetchOnly" value="0 | 1"/>
Attention: The IBM data server driver configuration file (db2dsdriver.cfg) syntax is available in Db2 11.5.4 and later.
Default setting:
The keyword is not set by default. CLI appends the "FOR FETCH ONLY" clause only when connected to certain server types.
Equivalent connection attribute:
SQL_ATTR_APPEND_FOR_FETCH_ONLY
Usage notes:
By default, CLI appends the "FOR FETCH ONLY" clause to read SELECT statements when connected to Db2® for z/OS® or Db2 for IBM i databases.

This keyword allows an application to control when CLI appends the "FOR FETCH ONLY" clause, for example, in a situation where an application is binding the CLI packages using different bind BLOCKING options (for example, BLOCKING UNAMBIG) and wants to suppress the blocking in order to keep positioned on a given row.

To change the default CLI behavior, the keyword can be set as follows:
  • 0: CLI never appends the "FOR FETCH ONLY" clause to read SELECT statements regardless of the server type it is connecting to.
  • 1: CLI always appends the "FOR FETCH ONLY" clause to read SELECT statements regardless of the server type it is connecting to.