The external name

The EXTERNAL NAME clause of the CREATE FUNCTION or CREATE PROCEDURE statement tells the database server where to find the object code for the UDR.

These statements store this location in the externalname column of the sysprocedures system catalog table. When the database server executes an SQL statement that contains a UDR, it loads into memory the shared-object file that contains its executable code. The database server examines the externalname column to determine which shared-object file to load.

In Registering a C UDR, the EXTERNAL NAME clause of this CREATE FUNCTION statement tells the database server that the object code for the abs_eq() user-defined function is in a Solaris shared-object file named abs.so, which is in the /usr/code directory.

By default, the database server uses the same name for the entry point into the shared-object file for the UDR object code as the name of the UDR. For example, the CREATE FUNCTION statement in Registering a C UDR specifies that the entry point in the abs.so shared-object file for the abs_eq() user-defined function is a C function named abs_eq().

The EXTERNAL NAME clause provides the following features to allow flexibility in the UDR external-name specification:
  • Specifying a different entry point
  • Including environment variables in the pathname

Each of these features is described in more detail below. For more information about the EXTERNAL NAME clause, see the External Reference segment of the Informix® Guide to SQL: Syntax.