Candidate list of routines
- 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.
CREATE IMPLICIT CAST (type1 AS type2)
CREATE IMPLICIT CAST (type2 AS type1)
CREATE FUNCTION g(type1, type1) ...
CREATE FUNCTION g(type2, type2) ...
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.