To query records in your current block or window, use the Find command or Query by Example.
The Find command displays a window in which you can specify search criteria. Depending on the block that you invoke Find from, one of two types of windows appears:
A find window that contains fields for entering search criteria.
A list window that shows all possible records that you can retrieve for the block.
Generally, a find window appears for a multi-record block, while a list window appears for a single-record block.
Choose Find... from the View menu or select the Find toolbar icon.
If a list window appears:
Use a list window as you would an LOV window. See Using a List of Values (LOV).
If a find window appears:
Enter as many search criteria as you can.
Select the Find button.
To retrieve a group of records based on more sophisticated search criteria than Find allows, use Query by Example. Query by Example allows you to specify search criteria in any of the queryable fields in the current block. The search criteria can include specific values, phrases containing wildcard characters, or query operators.
If you do not need to retrieve the records, but only want to know how many records match your search criteria, perform a query count.
From the View menu, choose Query by Example, then Enter.
This action switches your window from data entry mode to Enter Query mode. Queryable fields are displayed in blue.
Enter search criteria in the queryable fields. (Fields may be case-sensitive). To reuse criteria from your last search: From the View menu, choose Query by Example, then Show Last Criteria.
Important: In Enter Query mode, all check boxes are initially in a null state. To use a check box as a search criterion, you must explicitly check or uncheck it.
To perform the search: From the View menu, choose Query by Example, then Run.
To exit Enter Query mode without searching: From the View menu, choose Query by Example, then Cancel.
To perform a query count
Perform steps 1 and 2 from the previous task: "To use Query by Example".
From the View menu, choose Query by Example, then Count Matching Records. The window's message line displays the number of matching records.
The following table shows the query operators for most fields, their meanings, and an example expression:
Query Operators
| Operator | Meaning | Example Expression |
|---|---|---|
| = | equals | = 'Janet', = 107 |
| != | is not | != 'Bob', != 109 |
| > | greater than | > 99.1, > '01-JAN-04' |
| >= | at least | >= 55 |
| < | less than | < 1000.00 |
| <= | at most | <= 100 |
| #BETWEEN | between two values | #BETWEEN 1 AND 1000 |