Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query result a few rows at a time.One reason for doing this is to avoid memory overrun when the result contains a large number of rows.

updating incremental values in a plsql cursor-12

As with is used to open a cursor variable whose query was bound to it when it was declared. A list of actual argument value expressions must appear if and only if the cursor was declared to take arguments. The query plan for a bound cursor is always considered cacheable; there is no equivalent of , as the cursor's scrolling behavior was already determined.

Argument values can be passed using either positional or named notation.

In positional notation, all arguments are specified in order.

In named notation, each argument's name is specified using to separate it from the argument expression.

Similar to calling functions, described in Section 4.3, it is also allowed to mix positional and named notation.

Examples (these use the cursor declaration examples above): Once a cursor has been opened, it can be manipulated with the statements described here.These manipulations need not occur in the same function that opened the cursor to begin with.You can return a When a cursor is positioned on a table row, that row can be updated or deleted using the cursor to identify the row.There are restrictions on what the cursor's query can be (in particular, no grouping) and it's best to use functions can return cursors to the caller.This is useful to return multiple rows or columns, especially with very large result sets.To do this, the function opens the cursor and returns the cursor name to the caller (or simply opens the cursor using a portal name specified by or otherwise known to the caller). The cursor can be closed by the caller, or it will be closed automatically when the transaction closes.