for cs , n ; x

Read(534) Label: loop cursor,

Description:

Loop through a cursor.

Syntax:

for cs,n;x

Note:

The statement retrieves n records from the cursor and returns or retrieves records till x… has changed. Close the cursor once the retrieval is completed. This function is often used to fetch a large volume of records by group. Return all the remaining records and close the cursor when omitting n and x.

Parameters:

cs

Cursor

n

Number of records

x

Grouping expression, and cs is sorted by x. With x, n can be ignored.

Example:

 

A

B

 

1

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

=[]

 

2

for A1,10;SALARY

 

 

3

 

>B1.insert(0,A2)

Loop through the cursor, selecting records with the same SALARY value and inserting them into B1.