Restrictions on the SELFUNC Modifier
The selectivity function that you specify with the SELFUNC modifier has specific requirements.
The selectivity function that you specify must satisfy the following
criteria:
- It must take the same number of arguments as the current UDR.
- The data type of each argument must be SELFUNCARGS.
- It must return a value of type FLOAT between
0
and1
, which represents the percentage of selectivity of the function. (1
is highly selective;0
is not at all selective.) - It can be written in any language that the database server supports.
A user who invokes the UDR must have the Execute privilege both on that UDR and on the selectivity function that the SELFUNC modifier specifies.
Both the UDR and the selectivity function must have the same owner.
For information on how to use the mi_funcarg* functions to extract information about the arguments of a selectivity function, see the HCL OneDB™ DataBlade® API Programmer's Guide.