Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL how does REF CURSOR differ from CURSOR

Status
Not open for further replies.

jsteff

Technical User
May 22, 2003
109
US
I understand the use of a typical CURSOR in PL/SQL.

How does the REF CURSOR differ and when should I use it?

Thanks.
 
A ref cursor is just the same as a regular cursor with the difference being that you use a REF cursor when you do not know in advance the tables/columns you will be selecting/from. e.g In pseudocode

if(x)
then
open my_ref_cursor for select integer_col from table1
else
open my_ref_cursor for select string_col from table2
endif

Same cursor handles both (but different) selects
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top