Assign a UDR to a user-defined virtual-processor class

The SQL CREATE FUNCTION statement registers a user-defined routine.

The following CREATE FUNCTION statement registers the user-defined routine, GreaterThanEqual(), and specifies that calls to this routine are executed by the user-defined VP class named UDR:
CREATE FUNCTION GreaterThanEqual(ScottishName, ScottishName)
   RETURNS boolean 
   WITH (CLASS = UDR  )
   EXTERNAL NAME '/usr/lib/objects/udrs.so'
   LANGUAGE C
To execute this function, the onconfig file must include a VPCLASS parameter that defines the UDR class. If not, calls to the GreaterThanEqual function fail.
Tip: The CLASS routine modifier can specify any name for the VP class. This class name is not required to exist when you register the UDR. However, when you try to run a UDR that specifies a user-defined VP class for its execution, this class must exist and have virtual processors assigned to it.
To configure the UDR class, include a line similar to the following one in the onconfig file. This line configures the UDR class with two virtual processors and with no priority aging.
VPCLASS     UDR  ,num=2,noage

The preceding line defines the UDR VP class as a yielding VP class; that is, this VP class allows the C-language UDR to yield to other threads that must access to the UDR VP class. For more information about how to use the VPCLASS configuration parameter, see the Informix® Administrator's Reference.

For more information about the CREATE FUNCTION statement, see the Informix® Guide to SQL: Syntax.