Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## Using FOR FIRST versus FIND

> The `FIND` statement retrieves a single record in a single statement. It has its limitations, however, when compared to a `FOR` block. A `FIND` statement always uses only one index and does not allow use of field lists or word indexes. By contrast, a `FOR` block can use multiple indexes to evaluate a complex `WHERE` clause that involves fields not found in a single index. A `FOR` block can also use a word index and the `CONTAINS` keyword to locate records, and supports the use of a field list to retrieve only a subset of the fields from the selected records. Both word indexes and field lists are briefly described in the "Using indexes properly" section and the "Defining efficient queries and FOR EACH statements" section. You can use the form `FOR FIRST` when fetching just a single record, if any of the conditions apply that would give it a performance advantage. Of course, the `FOR FIRST` construct involves creating a block, which has an overhead of its own that the `FIND` statement doesn’t have. Therefore, it’s good practice not to use `FOR FIRST` in all cases unless you have a specific reason.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095