Unqualified distinct type, function, procedure, and specific names

The qualification of unqualified distinct type, function, stored procedure, and specific names depends on the SQL statement in which the unqualified name appears.

  • 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:
    • For distinct type names, DB2® searches the SQL path and selects the first schema in the path such that the distinct type exists in the schema and the user has authorization to use the distinct type.
    • 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.