Routine resolution with distinct data types

A distinct data type has the same internal storage representation as an existing data type, but it has a different name and cannot be compared to the source type without casting. Distinct types inherit functions from their source types. For more information, refer to Distinct data type.

When a UDR has distinct types in its parameter list, the database server resolves the routine signature, as follows:
  • When a routine signature contains a parameter that matches the distinct data type in the same position of the routine invocation, the routine-resolution process selects that routine to execute.
  • When a distinct data type in the argument list does not match the data type of the parameter in the same position of the routine signature, the database server searches for a UDR that accepts one of the following data types in the position of that argument:
    • A data type to which the user has defined an implicit cast from the type of the argument specified in the routine invocation

      For more information about casts, refer to Cast functions.

    • The source data type of the distinct type

The following topics describe source data type restrictions and provide procedures for routine resolution with these source types.