Skip to main content
Close announcements banner
Peek - script function

ON THIS PAGE

Peek - script function

Peek() returns the value of a field in a table for a row that has already been loaded. The row number can be specified, as can the table. If no row number is specified, the last previously loaded record will be used.

The peek() function is most often used to find the relevant boundaries in a previously loaded table, that is, the first value or last value of a specific field. In most cases, this value is stored in a variable for later use, for example, as a condition in a do-while loop.

Syntax:  

Peek(

field_name

[, row_no[, table_name ] ])

Return data type: dual

Arguments:  

Arguments
Argument Description
field_name Name of the field for which the return value is required.Input value must be given as a string (for example, quoted literals).
row_no

The row in the table that specifies the field required. Can be an expression, but must resolve to an integer. 0 denotes the first record, 1 the second, and so on. Negative numbers indicate order from the end of the table. -1 denotes the last record read.

If no row_no is stated, -1 is assumed.

table_name A table label without the ending colon. If no table_name is stated, the current table is assumed. If used outside the LOAD statement or referring to another table, the table_name must be included.

Limitations:  

The function can only return values from already loaded records. This means that in the first record of a table, a call using -1 as row_no will return NULL.