Persistent binding and cursor fetch statements

The Embedded SQL fetch command has an optional rebind/norebind clause that controls whether bindings persist in a particular fetch statement. This clause is useful if you need to override the precompiler options that you specified for a file. The rebind/norebind clause affects only the statement in which it appears. Bindings for other statements—including other fetch statements—are not affected.

If a fetch statement omits the rebind/norebind clause, the statement obeys the same binding rules as do other types of statements that use the cursor in question.

If a fetch statement contains the keyword rebind, bindings for host variables in the statement do not persist. Instead, they get rebound each time the statement executes—regardless of whether the -b option was used to precompile the declaration of the statement’s cursor.

If a fetch statement contains the keyword norebind but is precompiled with the -b option, the keyword has no effect.