SET PATH

The SET PATH statement changes the value of the CURRENT PATH special register.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared.

Authorization

No authorization is required to execute this statement.

Syntax

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram                     .-FUNCTION-.
          .-CURRENT--+----------+-.          .-=-.
>>-SET--+-+-----------------------+--PATH-+--+---+-------------->
        '-CURRENT_PATH--------------------'
 
     .-,---------------------------------------.
     V                                         |
>--+---+-schema-name-------------------------+-+-+-------------><
   |   +-SYSTEM PATH-------------------------+   |
   |   +-+-SESSION_USER-+--------------------+   |
   |   | '-USER---------'                    |   |
   |   +-SYSTEM_USER-------------------------+   |
   |   |              .-FUNCTION-.           |   |
   |   |   .-CURRENT--+----------+-.         |   |
   |   +-+-+-----------------------+--PATH-+-+   |
   |   | '-CURRENT_PATH--------------------' |   |
   |   +-variable----------------------------+   |
   |   '-string-constant---------------------'   |
   '-*LIBL---------------------------------------'
 

Description

schema-name
Identifies a schema. No validation that the schema exists is made at the time the PATH is set. For example, if a schema-name is misspelled, it could affect the way subsequent SQL operates. Although not recommended, PATH can be specified as a schema-name if it is specified as a delimited identifier.
SYSTEM PATH
This value is the same as specifying the schema names "QSYS","QSYS2".
SESSION_USER or USER
This value is the SESSION_USER special register.
SYSTEM_USER
This value is the SYSTEM_USER special register.
CURRENT PATH
Specifies the value of the CURRENT PATH special register before the execution of this statement. CURRENT PATH is not allowed if the current path is *LIBL.
variable
Specifies a variable that contains one or more schema names that are separated by commas.

The variable:

string-constant
A character constant with one or more schema names that are separated by commas.

Notes

Transaction considerations: The SET PATH statement is not a commitable operation. ROLLBACK has no effect on the CURRENT PATH.

Rules for the content of the SQL path:

The System Path: SYSTEM PATH refers to the system path for a platform. The schemas QSYS and QSYS2 do not need to be specified. If not included in the path, they are implicitly assumed as the last schemas (in this case, it is not included in the CURRENT PATH special register).

The initial value of the CURRENT PATH special register is *LIBL if system naming was used for the first SQL statement run in the activation group. The initial value is "QSYS","QSYS2", "X" (where X is the value of the USER special register) if SQL naming was used for the first SQL statement.

Using the SQL path: The CURRENT PATH special register is used to resolve user-defined distinct types, functions, and procedures in dynamic SQL statements. For more information see SQL path.

Example

The following statement sets the CURRENT PATH special register.

SET PATH = FERMAT, "McDuff", SYSIBM

The following statement retrieves the current value of the SQL path special register into the host variable called CURPATH.

EXEC SQL VALUES (CURRENT PATH) INTO :CURPATH;

The value would be "FERMAT","McDuff","SYSIBM" if set by the previous example.



[ Top of Page | Previous Page | Next Page | Contents | Index ]