VMS Help  —  RDML72  Statements  RDB$DB_KEY, Examples
    The following programs demonstrate the use of the RDB$DB_KEY
    value expression in a record selection expression. The programs
    sort the EMPLOYEES relation in ascending order of employee ID.
    Then, using the first 100 records from the sorted EMPLOYEES
    relation, the programs build two arrays: rdb_key_array and rdb_
    name_array. In building these arrays within a FOR statement,
    these programs create a one-to-one correspondence between the
    elements in the rdb_key_array and the rdb_name_array. Each time a
    new element is added to each of these arrays the next EMPLOYEES
    record from the sorted stream is printed.

    This one-to-one correspondence allows the programs to step
    through the EMPLOYEES records indirectly. This is demonstrated in
    the second FOR statement. The second FOR statement loops through
    the rdb_key_array in reverse order; each time the address of
    an array element in rdb_key_array is incremented, an EMPLOYEES
    record is accessed (also in reverse sorted order) and the
    employee's last name is printed.
Additional Information: explode extract
C Example Pascal Example
Close Help