Beginning with the PSM-96 standard (ANSI/ISO/IEC 9075-4:1995, Information technology—Database Languages—SQL—Part 4: Persistent Stored Modules (SQL/PSM). The PSM-96 standard dealt only with stored procedures), the ANSI SQL committee defines the following family of SQL‑invoked routines:
The ANSI SQL:2008 standard categorizes these SQL-invoked routines as either external routines or SQL routines. UDMs, like external UDFs and external stored procedures, are external routines.
An external routine is a user-defined function (UDF), method (UDM), or external stored procedure that is written in an external (meaning non‑SQL) language such as C or C++, while SQL routines are written entirely in the SQL language.
When an external routine associated with a UDT is invoked, the system passes a handle to the UDT argument instead of passing the UDT value. Given the handle, the external routine can either retrieve or set the value of a UDT argument by means of a set of library functions provided by Teradata for this purpose (see SQL External Routine Programming for details).