Precedence list of data types
To determine which routine in the candidate list might be appropriate
to an argument type, the database server builds a precedence list
of data types for the argument. The routine-resolution process builds
a precedence list, which is a partially ordered list of data types
to match. It creates the precedence list as follows (from highest
to lowest):
- The database server checks for a routine whose data type matches the argument passed to a routine.
- If the argument passed to the routine is a named row type that
is a subtype in a type hierarchy, the database server checks up the
type-hierarchy tree for a routine to execute.
For more information, refer to Routine resolution with user-defined data types.
- If the argument passed to the routine is a distinct type, the
database server checks the source data type for a routine to execute.
If the source type is itself a distinct type, the database server checks the source type of that distinct type. For more information, refer to Routine resolution with distinct data types.
- If the argument passed to the routine is a built-in data type,
the database server checks the candidate list for a data type in the
built-in data type precedence list for the passed argument.
For more information, refer to Precedence list for built-in data types.
If a match exists in this built-in data type precedence list, the database server searches for an implicit cast function.
- The database server adds implicit casts of the data types in steps 1 through 4 to the precedence list, in the order that the data types were added.
- If the argument passed to the routine is a collection type, the database server adds the generic type of the collection to the precedence list for the passed argument.
- The database server adds data types for which there are implicit casts between any data type currently on the precedence list (except the built-in data types) and some other data type.
If no qualifying routine exists, the database server returns the
following error message:
-674: Routine routine-name not found.
If the routine-resolution process locates more than one qualifying
routine, the database server returns this error message:
-9700: Routine routine-name cannot be resolved.