Show TOC

Statements Using the BufferLocate this document in the navigation structure

Use

The following statements are retrieved from the buffer:

  • SELECT statements specifying all keys of the defined key range with equality.

  • Additional conditions can be supplied:

    • Boolean expressions

    • Arithmetic expressions

    • Comparison predicates

      • LIKE

      • IS NULL

      • IN

      • BETWEEN

  • All Open SQL Data Types within the SQL statement are supported.

In the case of more complex queries, the query is passed on to the database because complex queries are usually executed more efficiently by the database management system.

Example

As an example we consider a table MYTAB with the key fields KEY1, KEY2, and KEY3 and the data field DATA. Let us assume the granularity of the buffer key range to be KEY1, KEY2.

Queries Using Table Buffer

            SELECT * FROM MYTAB WHERE KEY1 = ? AND KEY2 = ?

SELECT * FROM MYTAB 
    WHERE KEY1 = ? AND KEY2 = ? AND DATA = ?

SELECT * FROM MYTAB     
    WHERE KEY1 = ? AND KEY2 = ? AND KEY3 LIKE 'A%'

SELECT * FROM MYTAB 
    WHERE KEY1 = ? AND KEY2 = ? AND 
        (KEY3 NOT LIKE 'G_G%' OR 
        DATA < ? OR 
        DATA IS NOT NULL AND 
        DATA BETWEEN (KEY2 - 3) AND ?)