MainframeKit

-440

SQLSTATE 42884NEGATIVE SQLCODE

Db2 found no function or stored procedure it could call that matches the name, schema and argument list used, or the caller is not allowed to run it.

MOST LIKELY

A misspelled routine name, or the routine was never created here.

FIRST CHECK

Read the routine type and name in the message.

TRY IT ▸

MainframeKit assistant

What it means

When you CALL a procedure or use a function, Db2 looks for a definition with that name, in the right schema, whose parameters fit the arguments you pass, and which you are authorized to run. If none fits, it returns -440 with SQLSTATE 42884. The message tells you whether it was looking for a FUNCTION or a PROCEDURE, and the name.

A wrong argument count or data type is enough to cause it, even when a routine of that name exists. Less common causes are a passthrough-only expression run while CURRENT QUERY ACCELERATION is NONE, and features the application compatibility level does not allow.

Typical causes

  • A misspelled routine name, or the routine was never created here.
  • Wrong schema qualifier, or an unqualified name whose schema is not in the SQL path.
  • The number of arguments differs from the routine definition.
  • An argument has a data type the parameter does not accept, for example a CHAR literal for an INTEGER parameter.
  • The caller lacks EXECUTE authority on the routine.
  • The package's application compatibility level does not support something the statement uses.

How to fix it

  1. Read the routine type and name in the message.
  2. Check SYSIBM.SYSROUTINES for that name: schema, number of parameters and their types (SYSIBM.SYSPARMS).
  3. Qualify the name, or fix the PATH bind option or SET CURRENT PATH.
  4. Match the argument count and types to the definition; add a CAST where needed.
  5. Ask for EXECUTE authority on the routine if that is missing.
  6. For a passthrough-only expression, set CURRENT QUERY ACCELERATION to ELIGIBLE, ENABLE or ALL; for compatibility level issues, rebind at a level that supports the feature.

Example

Illustrative only; names and values are invented.

CALL PAYSCH.CALC_TAX(:WS-AMOUNT)
-- procedure is defined with 2 parameters
-- SQLCODE -440, NO AUTHORIZED PROCEDURE BY THE NAME CALC_TAX ...
-- SQLSTATE 42884