CURRENT PATH

The CURRENT PATH special register specifies the SQL path used to resolve unqualified distinct type names, function names, and procedure names in dynamically prepared SQL statements.

Start of changeIt is also used to resolve unqualified procedure names that are specified as variables in SQL CALL statements (CALL variable). The data type is VARCHAR(8843).End of change

The CURRENT PATH special register contains the value of the SQL path, which is a list of one or more schema names. Each schema name is enclosed in delimiters and separated from the following schema by a comma (any delimiters within the string are repeated as they are in any delimited identifier). The delimiters and commas are included in the length of the special register. The maximum number of schema names in the path is 268.

Start of changeIf a schema name has a different system name, the schema name is returned in the CURRENT PATH special register even if the system name was explicitly specified in the SET PATH statement.End of change

For information about when the SQL path is used to resolve unqualified names in both dynamic and static SQL statements and the effect of its value, see Unqualified type, variable, function, procedure, and specific names.

The initial value of the CURRENT PATH special register in an activation group is established by the first SQL statement that is executed.

  • If the first SQL statement in an activation group is executed from an SQL program or SQL package and the SQLPATH parameter was specified on the CRTSQLxxx command, the path is the value specified in the SQLPATH parameter. The SQLPATH value can also be specified using the SET OPTION statement.
  • Otherwise,
    • For SQL naming, "QSYS", "QSYS2", "SYSPROC", "SYSIBMADM", "the value of the Start of changerun-timeEnd of change authorization ID of the statement" .
    • For system naming, "*LIBL".

The value of the special register can be changed by executing the SET PATH statement. For details about this statement, see SET PATH. For portability across the platforms, it is recommended that a SET PATH statement be issued at the beginning of an application.

Example

Set the special register so that schema SMITH is searched before schemas QSYS and QSYS2 (SYSTEM PATH).

   SET CURRENT PATH SMITH, SYSTEM PATH