# classname_indexname_compare(tree)

> This function compares the value(s) referenced by the current position of the index cursor with value(s) supplied by the application.

### Prototype

>         MCO_RET	classname_indexname_compare(	/*IN*/ mco_trans_h trans,
>                                /*IN*/ mco_cursor_h cursor,
>                                /*IN*/ [const] <type> [*]param1,
>                                [[/*IN*/ uint2 len1,]
>                                [/*IN*/ [const] <type> [*]param2,
>                                [/*IN*/ uint2 len2,] …],
>                                /*OUT*/ int *result);

### Arguments

trans | A transaction handle that was established by`mco_trans_start()`
cursor | A cursor handle created by `classname_indexname_index_cursor()`
param1 | A variable of type type, where type is the data type of the classname.fieldname component of the index. If the index component is char or string, the param is a const char *
len1 | If param1 is a char or string, len1 specifies the length of the input buffer
param2 | If the index has more than one component (is a compound index) a search value is input for each component of the index
len2 | If param2 thru paramN are char or string, each such parameter argument is followed by a lenN parameter to specify the length of the paramN buffer.
result | A pointer to an integer that will be zero if the values compared are equal, less than zero if the values stored in the object referenced by the cursor are less than the values passed in, or greater than zero if the values stored in the object referenced by the cursor are greater than the values passed in

### Description

> This function compares the value(s) referenced by the current position of the index cursor with value(s) supplied by the application. It can be used to affect range-based retrievals. This function is only generated for tree indexes, and not for hash indexes.

### Return Codes

MCO_S_OK |
MCO_E_VOLUNTARY_NOT_EXIST | indexname is voluntary and has not been created, or was dropped
MCO_E_CURSOR_INVALID |

Related Topics