Home | Previous Page | Next Page   Extending an Operator Class >

Creating an Operator Class

For most indexing, the operators in the default operator class of a secondary-access method provide adequate support. However, when you want to order the data in a different sequence than the default operator class provides, you can define a new operator class for the secondary-access method.

The CREATE OPCLASS statement creates an operator class. It provides the following information about the operator class to the database server:

The database server stores this information in the sysopclasses system catalog table. You must have the Resource privilege for the database or be the DBA to create an operator class.

The database server provides the default operator class, btree_ops, for the generic B-tree access method. The following CREATE OPCLASS statement creates a new operator class for the generic B-tree access method. You must list the strategy functions in the order shown:

CREATE OPCLASS new_btree_ops FOR btree
   STRATEGIES (lessthan, lessthanorequal, equal,
      greaterthanorequal, greaterthan)
   SUPPORT(compare);

For more information, see Generic B-Tree Index.

You might want to create a new operator class for:

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]