Sunday 15 April 2018

SYS_REFCURSOR and REF CURSOR

REF CURSOR one of the most powerful,flexible and scalable ways to retuen query result from an Oracle Database to client application.

A FER CURSOR is a PL/SQL data type whose value is the memory address of a query work area on a database. In other works it's a pointer or handler to the result on the database.

While the REF CURSOR is returned to the client, the actual data is not returned until the client opens the REF CURSOR and requests the data. Note the data is not be retrived until the user attempts to read it.



SYS_REFCURSOR TYPE
Oracle introduced the pre-defined SYS_REFCURSOR type,
meaning that we can directly use it without declaring the ref cursor type every time.
variable_name SYS_REFCURSOR;

Ref Cursor Declaration

TYPE type_name IS REF CURSOR;
variable_name type_name;

No comments:

Post a Comment