Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## Defining and using queries

> There is a `DEFINE` statement for a query just as there is for other Progress objects. This is the general syntax:

>     DEFINE QUERY query-name FOR buffer [ , . . .] [ SCROLLING ].

> The statement gives the query a name and, in turn, names the buffer or buffers that the query uses. In the simplest case, the buffers are database table names. But you can also use other buffers you’ve defined as alternatives to table names or, as you’ll learn later in this chapter, buffers for temporary tables.

> If you want to reposition within the result set without using the `GET FIRST`, `NEXT`, `PREV`, and `LAST` statements, you need to define the query as `SCROLLING`. You’ll learn later in this section how to reposition within the result set of a scrolling query. You must also define a query that is going to be associated with a browse as `SCROLLING`. There is a slight performance cost to using the `SCROLLING` option, so you should leave it off if you are not using the capabilities it enables.

> You don’t actually specify the exact data selection statement for the buffers and the tables they represent until you open the query. At that time, you can describe the joins between tables and any other parts of a `WHERE` clause that filter the data from the tables. As with other `DEFINE` statements, nothing actually happens when Progress encounters the `DEFINE QUERY` statement. No data is retrieved. Progress simply registers the query name and sets up storage and a handle for the query itself as an object.

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