Release 10.1A: OpenEdge Data Management:
DataServer for ODBC

> ## FIND statements

> The DataServer fully supports the `FIND` `FIRST`, `CURRENT`, `LAST`, `PREV`, and `NEXT` statements for ODBC data-source tables that have unique indexes. If a table has no unique index, only the `FIND` `FIRST` and `FIND` `NEXT` statements are available for that table. The following section provides additional information about specific `FIND` statements.

> ##### FIND PREV and FIND LAST statements

> Applications that use the `FIND` `PREV` or `FIND` `LAST` statements work on ODBC data-source tables in a manner consistent with OpenEdge. The only exception occurs when the `FIND` `PREV` or `FIND` `LAST` statement fails. In the OpenEdge case, the cursor is located after the last record that was scanned. In the data-source case, the cursor behaves as if the failed `FIND` had never occurred. To support these statements, a data-source table must include support for the Progress `ROWID` function (through either a `PROGRESS_RECID` column or an indexed NUMBER column with unique values). See the "ROWID function" section for more information.

> For example, the procedure find.p accesses OpenEdge databases and ODBC data sources using the same `FIND` and `FIND PREV` statements in each case:

> find.p
>     /* This code accesses an OpenEdge database. */
>     FIND demo.customer WHERE demo.customer.cust-num = 3.
>     FIND PREV demo.customer.
>     DISPLAY demo.customer.cust-num
>       LABEL "PROGRESS DATABASE RESULT" WITH FRAME new-frame.

>     /* This code accesses an ODBC data source. */
>     FIND odbcdemo.customer WHERE odbcdemo.customer.cust-num = 3.
>     FIND PREV odbcdemo.customer.
>     DISPLAY odbcdemo.customer.cust-num
>       LABEL "ODBC DATA SOURCE RESULT" WITH COL 29

> When you run `find.p` with an OpenEdge table and a data-source table, you get these results (assuming that the database has records for customer numbers 1 through 4):

> If the `FIND` `PREV` statement fails, the cursor remains located after `customer.cust-num` 3 in the OpenEdge table, which was the last record scanned. In the data-source table, the cursor is positioned at `cust-num` 2. Failed finds do not affect cursor position in data-source tables.

> ##### FIND NEXT statement

> The `FIND` `NEXT` statement can generate different results when you use it to access an ODBC data source through the DataServer than when you use it to access an OpenEdge database. When accessing an ODBC data source:

> - A `FIND` `NEXT` statement refers to a previous `FIND` statement if the `WHERE` clauses in both statements are identical.

> - If the `WHERE` clauses are different, or if one of the statements does not have a `WHERE` clause, the `FIND` `NEXT` statement behaves like a `FIND` `FIRST` statement.

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