SQL Reference

SET CURRENT PACKAGESET

The SET CURRENT PACKAGESET statement sets the schema name (collection identifier) that will be used to select the package to use for subsequent SQL statements. This statement is not under transaction control.

Invocation

This statement can be embedded only in an application program. It is an executable statement that cannot be dynamically prepared. This statement is not supported in REXX.

Authorization

None required.

Syntax

                            .-=-.
>>-SET--CURRENT PACKAGESET--+---+----+-string-constant-+-------><
                                     '-host-variable---'
 

Description

string-constant
A character string constant with a maximum length of 30. If more than the maximum, it will be truncated at runtime.

host-variable
A variable of type CHAR or VARCHAR with a maximum length of 30. It cannot be set to null. If more than the maximum, it will be truncated at runtime.

Notes

Example

Assume an application called TRYIT is precompiled by userid PRODUSA, making 'PRODUSA' the default schema name in the bind file. The application is then bound twice with different bind options. The following command line processor commands were used:

DB2 CONNECT TO SAMPLE USER PRODUSA
DB2 BIND TRYIT.BND DATETIME USA
DB2 CONNECT TO SAMPLE USER PRODEUR
DB2 BIND TRYIT.BND DATETIME EUR COLLECTION 'PRODEUR'

This creates two packages called TRYIT. The first bind command created the package in the schema named 'PRODUSA'. The second bind command created the package in the schema named 'PRODEUR' based on the COLLECTION option.

Assume the application TRYIT contains the following statements:

 
 
 
EXEC SQL CONNECT TO SAMPLE;
 .
 .
EXEC SQL SELECT HIREDATE INTO :HD FROM EMPLOYEE WHERE EMPNO='000010'; (1)
 .
 .
EXEC SQL SET CURRENT PACKAGESET 'PRODEUR';                            (2)
 .
 .
EXEC SQL SELECT HIREDATE INTO :HD FROM EMPLOYEE WHERE EMPNO='000010'; (3)
 

(1)
This statement will run using the PRODUSA.TRYIT package because it is the default package for the application. The date is therefore returned in USA format.

(2)
This statement sets the schema name to 'PRODEUR' for package selection.

(3)
This statement will run using the PRODEUR.TRYIT package as a result of the SET CURRENT PACKAGESET statement. The date is therefore returned in EUR format.


[ Top of Page | Previous Page | Next Page ]