Syntax for creating a new operator class

After you create all the required support and strategy functions, you are ready to create the operator class.

The following syntax creates an operator class for use with the R-tree access method:
CREATE OPCLASS opclass
FOR RTREE 
STRATEGIES (strategy, strategy, strategy, strategy [, strategy])
SUPPORT (support, support, support 
    {, support, support, support, support {,support}} );

The FOR RTREE clause indicates to the database server that the operator class is for use with the R-tree access method.

The parameters are described in the following table.
Arguments Purpose Restrictions
opclass The name you want to give your operator class The name must be unique in the database.
strategy The names of the strategy functions you previously created Four strategy functions are required; any others are optional. You can list a maximum of 64 functions. You must include the following four strategy functions: Overlap, Equal, Contains, and Within. You can name them whatever you choose, but they must be listed as the first, second, third, and fourth functions, respectively.
support The names of the three required support functions you previously created; the four support functions for bulk-loading are optional. The support function RtreeInfo is also optional but must be in the eighth position if specified. You must include the following three support functions: Union, Size, and Inter. You can name them whatever you choose, but they must be listed as the first, second, and third functions, respectively. You can optionally include the four bulk-loading support functions: SFCbits, ObjectLength, SFCvalue, and SetUnion. You can name them whatever you choose, but they must be listed as the fourth, fifth, sixth, and seventh functions, respectively. If you do not specify the four optional bulk-loading support functions and you do specify RtreeInfo, put NULL in positions four, five, six, and seven.
The following example shows how to create the MyShape_ops1 operator class:
CREATE OPCLASS MyShape_ops1
FOR RTREE
STRATEGIES (Overlap, Equal, Contains, Within)
SUPPORT (Union, Size, Inter);

The strategy functions are called Overlap, Equal, Contains, and Within. The support functions are called Union, Size, and Inter.

The following example shows how to create an operator class that also supports bulk loading:
CREATE OPCLASS MyShape_ops2
FOR RTREE
STRATEGIES (Overlap, Equal, Contains, Within)
SUPPORT (Union, Size, Inter, SFCbits, ObjectLength, SFCvalue, SetUnion);

Note the additional optional bulk-loading support functions SFCbits, ObjectLength, SFCvalue, and SetUnion.

The following example shows how to create an operator class that does not support bulk loading but does include the RtreeInfo support function:
CREATE OPCLASS MyShape_ops3
FOR RTREE
STRATEGIES (Overlap, Equal, Contains, Within)
SUPPORT (Union, Size, Inter, NULL, NULL, NULL, NULL, RtreeInfo);
Restriction: You cannot alter an existing operator class that has only the Union, Size, and Inter support functions defined to add the bulk-loading support functions. Instead, you must create a new operator class to use these support functions for bottom-up building of R-tree indexes.

For more information about the CREATE OPCLASS statement, refer to the Informix® Guide to SQL: Syntax.