Start of changeUnqualified type, function, procedure, global variable, and specific namesEnd of change

Start of change The qualification of unqualified type (built-in type, distinct type, or array type), function, stored procedure, global variable, and specific names depends on the SQL statement in which the unqualified name appears.End of change

  • If an unqualified name is the main object of an ALTER, CREATE, COMMENT, DROP, GRANT, or REVOKE statement, the name is implicitly qualified with a schema name as follows:
    • In a static statement, the implicit schema name is the identifier specified in the QUALIFIER option of the BIND subcommand or the CREATE or ALTER statement for a SQL routine. If this option is not in effect for the package or procedure, the implicit qualifier is the authorization ID of the owner of the package or procedure.
    • In a dynamic statement, the implicit schema name is the schema in the CURRENT SCHEMA special register.
  • Otherwise, the implicit schema name for the unqualified name is determined as follows:
    • Start of changeFor distinct type and array type names, Db2 searches the SQL path and selects the first schema in the path such that the data type exists in the schema and the user has authorization to use the type.End of change
    • Start of changeFor global variable names, Db2 searches the SQL path and selects the first schema in the path such that the global variable exists in the schema and the user has authorization to use the global variable.End of change
    • For function names, Db2 uses the SQL path in conjunction with function resolution, as described in Function resolution.
    • For stored procedure names in CALL statements, Db2 searches the SQL path and selects the first schema in the path such that the schema contains a procedure with the same name and number of parameters and the user has authorization to use the procedure.
    • For stored procedure names in ASSOCIATE LOCATORS and DESCRIBE PROCEDURE statements, Db2 does not use the SQL path because an implicit schema name is not generated for these statements.

    For information about the SQL path, see SQL path.