Informix Error -9700: Routine (routine_name) ambiguous - more than one routine resolves to given signature.
Cause and resolution
Routine (routine_name) ambiguous - more than one routine resolves to given signature.
This problem happens when an argument (or its source type or parent type) has implicit casts to the parameters of two or more routines.
For example, assume two routines exist called routine_name(paramtype1) and routine_name(paramtype2), and routine_name is invoked with routine_name(argtype). Also, implicit casts exist from argtype to paramtype1 and argtype to paramtype2. In this case, this error is raised.
The error is also raised, if instead of argtype, argtype_dad which is in the source type hierarchy of argtype (if argtype is a distinct type) or in the super type hierarchy of argtype (if argtype is a row type) has casts to paramtype1 and paramtype2.
You will need to redefine the implicit casting scheme, such that only one casts exists from argtype to either paramtype1 or paramtype2 or remove one of the routines.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9700 fires when an argument (or its source/parent type) has implicit casts to the parameters of two or more overloaded routines with the same name — per the official guidance.
- Implicit casts existing from the call's argument type to more than one candidate
routine's parameter type, per the official guidance — the direct, only cause. For
example,
routine_name(paramtype1)androutine_name(paramtype2)both exist, the call isroutine_name(argtype), and implicit casts exist fromargtypeto bothparamtype1andparamtype2. - The same ambiguity arising via a parent type of the argument, per the official guidance, rather than the argument's own type.
Solutions / Resolution
- Use an explicit CAST on the argument to pick a specific overload, consistent with the official guidance's description of the ambiguity — narrowing the argument's type to exactly one candidate resolves it.
- Or remove/rename one of the ambiguous overloaded routines, if the overload set itself is the problem.
Examples
An ambiguous overloaded call
CREATE FUNCTION my_func(a paramtype1) RETURNING INT ...;
CREATE FUNCTION my_func(a paramtype2) RETURNING INT ...;
SELECT my_func(some_argtype_value) FROM tab; -- -9700 if argtype casts to both
Corrected — explicit cast
SELECT my_func(CAST(some_argtype_value AS paramtype1)) FROM tab;
Diagnostic Checks
- Check the system catalog for all overloads of the named routine and the implicit casts available from the argument's type, and add an explicit cast to disambiguate.
Related Errors / Related Topics
- -9709 — "More than one distinct type of the parameter type have cast to argument type." The same class of routine-overload-ambiguity error, specific to ambiguity arising through distinct types inheriting a routine.
The call matched more than one overloaded routine via implicit casting — add an explicit cast to disambiguate, or resolve the overload set.