for cs,n;x

Read(1092) Label: loop cursor,

Description:

Loop through a cursor.

Syntax:

for cs,n;x

Note:

The statement retrieves n records from the cursor or retrieves records till x… has changed. Close the cursor once the retrieval is completed.

 

Parameter:

cs

A cursor.

n

Number of records;

Its default value is theRetrieval Batch Sizeset up in the designer. When esProc is integrated in a third-party application, the default value is fetchCount configured in raqsoftConfig.xml.

x

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

Example:

 

A

B

 

1

=demo.cursor("select * from EMPLOYEE")

=[]

 

2

for A1,100

 

 

3

 

>B1.insert(0,A2)

循环游标,每次取100条记录数据插入B1

 

 

 

A

B

 

1

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

=[]

 

2

for A1,100;SALARY

 

 

3

 

>B1.insert(0,A2)

Loop through the cursor, selecting records with the same SALARY value and inserting them into B1; ignore parameter n when parameter x is present.