Example 1
Print the first ten records in a relation:
RDO> FOR FIRST 10 E IN EMPLOYEES
cont> SORTED BY E.LAST_NAME
cont> PRINT E.*
cont> END_FOR
Example 2
Use FIRST and SORTED BY to find the maximum values for a field:
RDO> FOR FIRST 5 C IN CURRENT-SALARY
cont> SORTED BY C.SALARY_AMOUNT
cont> PRINT
cont> C.FIRST-NAME,
cont> C.LAST-NAME
cont> END_FOR
Example 3
Use FIRST with a value expression:
&RDB& GET TENTH = ( COUNT OF E IN EMPLOYEES / 10 )
&RDB& START_TRANSACTION READ_WRITE
&RDB& FOR FIRST TENTH E IN EMPLOYEES
SORTED BY E. LAST_NAME
.
.
.