Setting the value of OPTCOMPIND within a session
You can set or change the value of OPTCOMPIND within a session for different kinds of queries. To do this, use the SET ENVIRONMENT OPTCOMPIND statement, not the OPTCOMPIND configuration parameter or the OPTCOMPIND environment variable.
For a DSS query, you should set the value of OPTCOMPIND to 2
or 1
,
and you should be sure that the isolation level is not set to Repeatable
Read. For an OLTP query, you could set the value to 0
or 1
with
the isolation level not set to Repeatable Read.
SET ENVIRONMENT OPTCOMPIND DEFAULT;
No other user sessions or routines are affected by SET ENVIRONMENT OPTCOMPIND statements that you execute, because their scope is local to the routine in which they are issued, rather than the entire session.