Receive the return value

When the mi_routine_exec() function executes a user-defined function, it returns as an MI_DATUM value, the return value of the user-defined function that it has executed.

This MI_DATUM value contains a value appropriate for the passing mechanism for the data type. Most data types are to be passed by reference from the UDR. For a list of data types that can be passed by value, see Types of values that fit in an MI_DATUM structure (Passed by value).

You can then use C casting to convert this MI_DATUM value to the appropriate data type. You can obtain information about the return type (such as its data type) from the MI_FPARAM structure.

If the user-defined function returned an SQL NULL value, mi_routine_exec() returns a NULL-valued pointer and sets the status argument to MI_OK.

For examples of how to receive a UDR return value from mi_routine_exec(), see Sample mi_routine_exec() calls. For more information about MI_DATUM values, see The MI_DATUM data type.