-458   IN A REFERENCE TO FUNCTION function-name BY SIGNATURE, A MATCHING FUNCTION COULD NOT BE FOUND

Explanation

In a reference to function function-name by signature, no matching function could be found. The problem could be with the data type or some other attributes of a parameter. For some data types there are attributes in addition to data type:

  • Length, precision, or scale

    While it is not necessary to specify a length, precision, or scale attribute for a data type, if one is specified then there must be an exact match on the corresponding specification of the parameter for the existing function as defined in SYSPARMS.

    A type of FLOAT(n) does not need to match the defined value for n since 1<=n<=21 means REAL and 22<=n<=53 means DOUBLE. Matching occurs based on whether the type is REAL or DOUBLE.

    However, a match on data type is sufficient.

    To indicate this, an empty set of parentheses must be specified for the data types that allow a specification of length, precision, or scale. For example, assuming a function exists for which a parameter was defined as CHAR(12) on the CREATE FUNCTION statement, a reference to that function by a signature could specify this parameter as either CHAR(12), or CHAR(). The CHAR() syntax provides a way to say, "do not care about length, precision and scale attributes in finding a matching function".

    FLOAT() cannot be used since the parameter value indicates different data types (REAL or DOUBLE).

    If, however, neither length, precision, scale, or empty parenthesis were specified, then normal default rules apply. For example, a specification of CHAR would result in CHAR(1) as on the CREATE TABLE statement. Furthermore, this implicit specification of length, precision, or scale must exactly match the corresponding specification of the parameter for the existing function as defined in SYSPARMS.

  • Subtype, or encoding scheme

    You do not need to specify the subtype or encoding scheme (CCSID clause) to identify an existing function in the database. However, if a subtype or encoding scheme is specified then there must be an exact match on the corresponding specification of the parameter for the existing function as defined in SYSPARMS.

Unqualified function names:

  • For ALTER FUNCTION, DROP FUNCTION, COMMENT ON FUNCTION, GRANT and REVOKE statements for EXECUTE on functions, an unqualified function name is implicitly qualified with the default schema, and this is the schema where the function with the problem can be found.
  • In the SOURCE clause of a CREATE FUNCTION statement, the qualification comes from the SQL path. In this case, DB2® could not resolve the invocation of a function using the schemas in the user's SQL path. For details, see CREATE FUNCTION (sourced).

System action

The statement cannot be processed.

Programmer response

Possible responses include:
  • Changing the SQL path to include the correct schema.
  • Changing the attributes of the parameters.
  • Using a SPECIFIC name to refer to the function instead of a signature.

SQLSTATE

42883