Cursor Loop
The use of cursors in WHILE and LOOP statements is called a cursor loop. Generally, OPEN, FETCH, and CLOSE statements are needed in cursor loop. The following describes a loop that is applicable to a static cursor loop without executing the four steps of a static cursor.
Precautions
- The UPDATE operation for the queried table is not allowed in the loop statement.
- The variable loop_name is automatically defined and is valid only in this loop. The type and value of loop_name are the same as those of the query result of select_statement.
- The %FOUND, %NOTFOUND, and %ROWCOUNT attributes access the same internal variable in GaussDB(DWS). Transactions and anonymous blocks cannot be accessed by multiple cursors at the same time.
Examples
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.