IBM Books

SQL Reference

CURRENT PATH

The CURRENT PATH special register specifies a VARCHAR(254) value that identifies the SQL path to be used to resolve function references and data type references that are used in dynamically prepared SQL statements. 20 CURRENT PATH is also used to resolve stored procedure references in CALL statements. The initial value is the default value specified below. For static SQL, the FUNCPATH bind option provides a SQL path that is used for function and data type resolution (see the Command Reference for more information on the FUNCPATH bind option).

The CURRENT PATH special register contains a list of one or more schema-names, where the schema-names are enclosed in double quotes and separated by commas (any quotes within the string are repeated as they are in any delimited identifier).

For example, a SQL path specifying that the database manager is to first look in the FERMAT, then XGRAPHIC, then SYSIBM schemas is returned in the CURRENT PATH special register as:

   "FERMAT","XGRAPHIC","SYSIBM"

The default value is "SYSIBM","SYSFUN",X where X is the value of the USER special register delimited by double quotes.

Its value can be changed by the SET CURRENT FUNCTION PATH statement (see SET PATH). The schema SYSIBM does not need to be specified. If it is not included in the SQL path, it is implicitly assumed as the first schema. SYSIBM does not take any of the 254 characters if it is implicitly assumed.

The use of the SQL path for function resolution is described in Functions. A data type that is not qualified with a schema name will be implicitly qualified with the schema name that is earliest in the SQL path and contains a data type with the same unqualified name specified. There are exceptions to this rule as described in the following statements: CREATE DISTINCT TYPE, CREATE FUNCTION, COMMENT ON and DROP.

Example

Using the SYSCAT.VIEWS catalog view, find all views that were created with the exact same setting as the current value of the CURRENT PATH special register.

    SELECT VIEWNAME, VIEWSCHEMA FROM SYSCAT.VIEWS
      WHERE FUNC_PATH = CURRENT PATH

Footnotes:

20
CURRENT FUNCTION PATH is a synonym for CURRENT PATH.


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

[ DB2 List of Books | Search the DB2 Books ]