Candidate list of routines
The database server finds a list of candidate routines from the sysprocedures system
catalog table that have the following characteristics:
- The same routine name
- The same routine type (function or procedure)
- The same number of arguments
- The Execute privilege on the routine in the current session
- Belong to the current user or user informix
If the candidate list does not contain a UDR with the same data type as an argument specified in the routine invocation, the database server checks for the existence of cast routines that can implicitly convert the argument to a data type of the parameter of the candidate routines.
For example, suppose you create the following two casts and two
routines:
CREATE IMPLICIT CAST (type1 AS type2)
CREATE IMPLICIT CAST (type2 AS type1)
CREATE FUNCTION g(type1, type1) ...
CREATE FUNCTION g(type2, type2) ...
Suppose you invoke function g with the following
statement:
EXECUTE FUNCTION g(a_type1, a_type2)
The database server considers both functions as candidates. The routine-resolution process selects the function g(type1, type1) because the leftmost argument is evaluated first. The database server executes the second cast, cast(type2 AS type1), to convert the second argument before the function g(type1, type1) executes.
For more information about casting, refer to Create user-defined casts.
Tip: Consider
the order in which the database casts data and resolves routines as
part of your decision to overload a routine.