SQL statements that set special registers

A number of SET statements can cause problems when an application runs them statically. Use bind options to set special registers.
Table 1. Bind options for setting special registers.
Special register DBMS Bind option
CURRENT DECFLOAT ROUNDING MODE
  • DB2® for Linux, UNIX, and Windows
  • DB2 for z/OS®
ROUNDING CEILING | DOWN | FLOOR | HALFDOWN | HALFEVEN | HALFUP | UP
CURRENT DEGREE
  • DB2 for Linux, UNIX, and Windows
  • DB2 for z/OS
DEGREE 1 | ANY
CURRENT OPTIMIZATION HINT DB2 for Linux, UNIX, and Windows Not available
DB2 for z/OS OPTHINT hint-id
CURRENT PACKAGESET DB2 for Linux, UNIX, and Windows Supports a SET CURRENT PACKAGESET, but not a special register.
DB2 for z/OS BIND PACKAGE (package-name) for the single package-name in the CURRENT PACKAGESET
CURRENT PATH, or CURRENT_PATH
  • DB2 for Linux, UNIX, and Windows
  • DB2 for z/OS
PATH schema-name | USER | schema-name , USER
CURRENT RULES DB2 for Linux, UNIX, and Windows Not available
DB2 for z/OS SQLRULES DB2 | STD
CURRENT SCHEMA, or CURRENT_SCHEMA
  • DB2 for Linux, UNIX, and Windows
  • DB2 for z/OS
QUALIFIER schema-name
CURRENT SQLID DB2 for Linux, UNIX, and Windows Not available
DB2 for z/OS None; the ID determined by the authorization that was used to perform the bind.
If your application uses SET statements to prepare a Connection object for subsequent SQL statements, those SET statements will not cause problems during static execution if the following conditions are true.
  • The application runs the SET statements immediately after establishing a connection to a data source.
  • The special register either has a corresponding bind option, or applies to both dynamic and static SQL.

Feedback