Q

REF cursors explained

Can you throw some light on REF cursors? Are they the same as the usual cursors that we define in PL/SQLs? If not, how do they differ.. and when can we use them?

REF cursors are different than your typical, standard cursors. With standard cursors, you know the cursor's query ahead of time. With REF cursors, you do not have to know the query ahead of time. REF cursors let you create a cursor to be used in your PL/SQL block, for instance, and use that cursor, without knowing ahead of time what your particular query might be. This is often used when the cursor's query will be given to a stored procedure or function at runtime. For instance, you might want a function to compute the average of a column on a particular table. But you don't know ahead of time what the table or column will be. With regular cursors, you would need to know. But with REF cursors, you can pass the table and column to the function, and have the REF cursor build the cursor "on the fly".

For More Information


This was first published in December 2002
This Content Component encountered an error

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close