Execute the routine

The mi_routine_exec() function can execute any UDR that is registered in the open database. Therefore, any UDR that you can use in an SQL statement, you can directly execute with mi_routine_exec().

After you obtain a function descriptor for a registered UDR or cast function, the mi_routine_exec() function sends it to the routine manager for execution. You can use the function descriptor in repeated calls to mi_routine_exec(). This executed routine runs in the virtual processor (VP) that was defined for it. This VP is not necessarily the VP in which the calling UDR runs.
Restriction: You cannot use the Fastpath interface to execute iterator functions or SPL functions with the WITH RESUME keywords in their RETURN statement. However, to simulate iterator functionality, you can call the same UDR repeatedly, passing it the same MI_FPARAM structure. Each invocation of the UDR can return one value.
The mi_routine_exec() function takes the following steps:
  1. Passes the argument values in its argument list to the UDR
  2. Returns any return value from the user-defined function to the calling module