Strategy Specification

The STRATEGIES keyword introduces a comma-separated list of function names or function signatures for the new operator class. Each element of this list is called a strategy specification and has the following syntax:

Strategy Specification

1  strategy_function?   (  input_type , input_type?  , output_type )
Element Description Restrictions Syntax
input_type Data type of an input parameter to the strategy function for which you intend to use a specific secondary-access method A strategy function accepts two input parameters and can have one optional output parameter Data Type
output_type Data type of the optional output parameter of the strategy function Optional output parameter for side-effect indexes Data Type
strategy_function Strategy function to associate with the specified operator class Must be listed in the order that the specified secondary-access method expects Identifier
Each strategy_function is an external function. The CREATE OPCLASS statement does not verify that a user-defined function of the name you specify exists. However, for the secondary-access method to use the strategy function, the external function must be:
  • Compiled in a shared library
  • Registered in the database with the CREATE FUNCTION statement
Optionally, you can specify the signature of a strategy function in addition to its name. A strategy function requires two input parameters and an optional output parameter. To specify the function signature, specify:
  • An input data type for each of the two input parameters of the strategy function, in the order that the strategy function uses them
  • Optionally, one output data type for an output parameter of the strategy function

You can specify UDTs as well as built-in data types. If you do not specify the function signature, the database server assumes that each strategy function takes two arguments of the same data type and returns a BOOLEAN value.