PL/SQL User's Guide and Reference

Contents Index Home Previous Next

Cursor Variable Improvements

Now, cursor variables are available to every PL/SQL client. For example, you can declare a cursor variable in a PL/SQL host environment such as an OCI or Pro*C program, then pass it as a bind variable to PL/SQL. Moreover, application development tools such as Oracle Forms and Oracle Reports, which have a PL/SQL engine, can use cursor variables entirely on the client side.

The Oracle Server also has a PL/SQL engine. So, you can pass cursor variables back and forth between an application and server via remote procedure calls (RPCs). And, if you have a PL/SQL engine on the client side, calls from client to server impose no restrictions. For example, you can declare a cursor variable on the client side, open and fetch from it on the server side, then continue to fetch from it back on the client side.

Furthermore, now you can define weak (nonrestrictive) REF CURSOR types. As the following example shows, a strong REF CURSOR type definition specifies a return type, but a weak definition does not:

DECLARE
   TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;  -- strong
   TYPE GenericCurTyp IS REF CURSOR;  -- weak 

Weak REF CURSOR types are more flexible because PL/SQL lets you associate a weakly typed cursor variable with any query.

Also, now you can apply the cursor attributes %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT to a cursor variable. They return useful information about the execution of a multi-row query.

For more information, see "Using Cursor Variables" [*].


Contents Index Home Previous Next