Determine if a routine is a variant function

Before you execute a UDR with the Fastpath interface, you might need to determine whether this routine is variant. By default, a UDR is a variant function.

A variant function has one of the following characteristics:
  • It returns different values when it is invoked with the same arguments.
  • It has variant side effects that access some database or variable state.

A nonvariant function always returns the same value when it receives the same arguments and it has none of the above variant side effects. Therefore, nonvariant functions cannot contain SQL statements or access external files.

To determine whether a UDR is variant, pass its function descriptor to the mi_func_isvariant() function. This function determines whether the user-defined function was registered with the VARIANT or NOT VARIANT routine modifier of the CREATE FUNCTION or CREATE PROCEDURE statement. If the UDR was registered with neither the VARIANT nor NOT VARIANT modifier, the variant column of sysprocedures indicates that the UDR is variant.

The mi_func_isvariant() function indicates whether a UDR is variant, as follows.
1
The routine that the function descriptor describes is variant.
2
The routine that the function descriptor describes is not variant.