SEEK command

Used to search an indexed character field for the first value that matches the specified character expression or character string.


SEEK search_expression



Specifies the character expression to search for. The search_expression parameter can be any valid character expression, a character variable, or a quoted string. The parameter is case-sensitive, and can include leading spaces, which are treated like characters.


Use the SEEK command to move directly to the first record in a table containing the specified search_expression in the indexed character field.

To use the command, the table you are searching must be indexed on a character field in ascending order. If multiple character fields are indexed in ascending order, only the first field specified in the index is searched. The command cannot be used to search non-character index fields, or character fields indexed in descending order.

Partial matching is supported – that is, the search expression can be contained by a longer value in the indexed field. However, the search expression must appear at the start of the field to constitute a match.

The SEEK command produces one of the following results, depending on whether the search expression is found:

The SEEK command is not affected by the Exact Character Comparisons option (SET EXACT ON/OFF).


The following example locates the first value in the Card_Number field that exactly matches, or starts with, the value contained in the v_card_num variable. The Card_Number field has been defined as a character field and is indexed in ascending order.

INDEX ON Card_Number TO "CardNum" OPEN
SEEK v_card_num
Related reference
FIND command
LOCATE command

(C) 2015 ACL Services Ltd. All Rights Reserved.