With the operator function written, compiled, and linked
into a shared-object file, you can register this function in the database
with the CREATE FUNCTION statement. You must have the appropriate
privileges for this registration to be successful. For more information,
see the section on user-defined aggregates in the Informix® User-Defined Routines and
Data Types Developer's Guide.
The following code fragment shows the CREATE FUNCTION
statement that overloads the plus() function with a new version
that handles the complexnum_t named row type. Figure 1: Registering
the overloaded plus() function
CREATE FUNCTION plus(arg1 complexnum_t, arg2 complexnum_t)
RETURNS complexnum_t
EXTERNAL NAME '/usr/udrs/aggs/sums/sqsum.so(complex_plus)'
LANGUAGE C;
Tip: Because SUM is a built-in aggregate, you do
not have to use the CREATE AGGREGATE statement to define the SUM aggregate.