We have moved to a new website!

If you are not redirected within 3 seconds, click here to go my homepage.

PL/SQL Ref Cursor

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

A cursor variable, unlike a static cursor, is not associated with a particular query. The same cursor variable can be opened a number of times with separate OPEN FOR statements containing different queries. A new result set is created each time and made available through the cursor variable.

Strong typed REF CURSOR

    TYPE customer_t IS REF CURSOR RETURN customers%ROWTYPE;
    c_customer customer_t;

Weak typed REF CURSOR

    TYPE customer_t IS REF CURSOR;
    c_customer customer_t;

The SYS_REFCURSOR data type is known as a weakly-typed REF CURSOR type. Strongly-typed cursor variables of the REF CURSOR type require a result set specification.



Read More