All Products
Search
Document Center

PolarDB:REF CURSOR

Last Updated:Dec 17, 2024

A cursor variable is a cursor that actually contains a pointer to a query result set. The result set is determined by the execution of the OPEN FOR statement by using the cursor variable.

A cursor variable is not tied to a single particular query such as a static cursor. The same cursor variable may be opened a number of times by using OPEN FOR statements containing different queries. Each time, a new result set is created from that query and made available by using the cursor variable.

REF CURSOR types may be passed as parameters to or from stored procedures and functions. The return type of a function may also be a REF CURSOR type. This provides the capability to modularize the operations on a cursor into separate programs by passing a cursor variable between programs.