Using the SQL SET OPTION Statement
January 24, 2007 Michael Sansoterra
SQL’s SET OPTION statement is a powerful way to control the parameters of the DB2 execution environment in which an SQL program runs. Using it properly will allow SQL code to execute consistently between different environments–including those thorny differences that often arise between green screen and client/server environments. Read on to find out why this statement is essential to embedded SQL programs and persistent stored modules (SQL based triggers, procedures and functions).
First of all, SET OPTION is a statement that is evaluated at “compile time.” It never actually gets executed. Therefore SET OPTION can only be specified once in