Register a C UDR

The CREATE FUNCTION statement registers user-defined functions in the database. The CREATE PROCEDURE statement registers user-defined procedures in the database. These functions store information about the UDR in the sysprocedures system catalog table.

Registration for a C UDR requires the following special clauses of the CREATE FUNCTION and CREATE PROCEDURE statements to help the database server identify the routine:
  • The required EXTERNAL NAME clause specifies the path to the shared-object file that contains the compiled C code for the UDR.
  • The required LANGUAGE clause specifies the language in which the body of the UDR is written.
  • The optional WITH clause specifies the routine modifiers for the UDR.
For example, the following figure shows a CREATE FUNCTION statement that registers a user-defined function named abs_eq() whose corresponding C function is in a shared-object file named abs.so.
Figure 1: Registering a C UDR

begin figure description - This figure is described in the surrounding text. - end figure description