What is Ref cursor when we use ref cursor andadvantage of ref cursor

Showing Answers 1 - 14 of 14 Answers

narendra kumar mshar

  • Jun 12th, 2006
 

ans:  Ref cursor is used for dynamic where clause ,and it is used for fast processing

by

Narendra kumar and Friend

shriram Group COmp(Madras) New Delhi

  Was this answer useful?  Yes

Normally in cursors, query is defined at the time the cursor is created.

 but in some cases, the query we need to use for a cursor is unknown until run-time. Oracle uses ref-cursors and cursor variables to satisfy this requirement.

  Was this answer useful?  Yes

The scope of cursor is limited to a block/ programme.  here block/ programme means upto a end of procedure/function and only one fixed query can be attached to that cursor.

where as the scope of ref cursor is global. Generally ref cursor is used with package so diffrent internal procedure/function of that package can use this ref cursor with diffrent query. so one cursor can have multiple query.

suresh reddi

  • Aug 19th, 2011
 

Using ref cursor we can pass different values( i.e by changing parameters) to the cursor which is declared in the package specification from the package body.

Ref cursors are of 2 types

a) weak ref cursor ie., ref cursor not having return clause
b) Strong ref cursor ie., ref cursor having return type

  Was this answer useful?  Yes

Deepika S Verma

  • Mar 10th, 2014
 

Ref Cursors are used in two conditions
(1) When we have a dynamic query, means when we get the information at runtime related to query(like column name, table name etc)
(2) Or when we want to pass whole resultset to another proc/func.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions