Geeks Talk

Prepare for your Next Interview




Ref cursors, Packages

This is a discussion on Ref cursors, Packages within the Oracle forums, part of the Databases category; Hi friends, i need help regarding ref cursors. What is the main use of Ref cursors? How to use ref cursors? How to execute ref cursors? is ref cursors create ...


Go Back   Geeks Talk > Databases > Oracle

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-25-2008
Junior Member
 
Join Date: Jun 2008
Location: hyderabad
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
jaladurgam3127 is on a distinguished road
Unhappy Ref cursors, Packages

Hi friends, i need help regarding ref cursors.
What is the main use of Ref cursors?
How to use ref cursors?
How to execute ref cursors?

is ref cursors create along with procedures and functions or packages?
am preparing for interview.
please help me in this regard.
so that am greatful to u.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-25-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Ref cursors, Packages

>>What is the main use of Ref cursors?

A ref cursor is basically a data type. A variable created based upon that datatype is called a cursor variable. A cursor variable can be assosiated with different queries at run time.

The main advantages are
1. Ref cursors are dynamic in nature. Its contents can be changed dynamically depending upon the requirement.
2. A Ref cursor can be passed as parameters to sub programes.
3. A Ref cursor can be returned to a client.


>>is ref cursors create along with procedures and functions or packages?
A ref cursor can be used in procedures, functions and packages.


For examples follow the links
How to use the oracle REF CURSOR
Oracle Ref Cursors
Reply With Quote
  #3 (permalink)  
Old 06-25-2008
Junior Member
 
Join Date: Jun 2008
Location: vijayawada
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Hasina is on a distinguished road
Re: Ref cursors, Packages

Ref cursor is noting but a dynamic cursor. There is no need to declare the in the declaration block. We can call it directly where we need in procedure or package or function.
Reply With Quote
  #4 (permalink)  
Old 06-25-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Ref cursors, Packages

>>There is no need to declare the in the declaration block.

How can you use a cursor variable of type REF cursor without declaring it? It is must.

type c1 is ref cursor;
empvar c1;

But in declaration block you need not associate a query with cursor variable. You can dynamically do it at run time.
Reply With Quote
  #5 (permalink)  
Old 06-26-2008
Junior Member
 
Join Date: Jun 2008
Location: hyderabad
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
jaladurgam3127 is on a distinguished road
Re: Ref cursors, Packages

hi krishna garu,
Thank you very much sir.
it is very useful information to me.
Reply With Quote
  #6 (permalink)  
Old 06-26-2008
Junior Member
 
Join Date: Jun 2008
Location: hyderabad
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
jaladurgam3127 is on a distinguished road
Re: Ref cursors, Packages

hi krishna garu,
Thank you very much sir.
it is very useful information for me.
Reply With Quote
  #7 (permalink)  
Old 06-26-2008
Junior Member
 
Join Date: Jun 2008
Location: hyderabad
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
jaladurgam3127 is on a distinguished road
Re: Ref cursors, Packages

Quote:
Originally Posted by krishnaindia2007 View Post
>>There is no need to declare the in the declaration block.

How can you use a cursor variable of type REF cursor without declaring it? It is must.

type c1 is ref cursor;
empvar c1;

But in declaration block you need not associate a query with cursor variable. You can dynamically do it at run time.
hi krishna garu,
Thank you very much sir.
it is very useful information for me.
Reply With Quote
  #8 (permalink)  
Old 07-10-2008
Junior Member
 
Join Date: Jul 2008
Location: TN
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
subudhi is on a distinguished road
Re: Ref cursors, Packages

what is ref cursors? ref cursor mean to reference cursor, that is call pointer. This pointer is reference to the cursor variable. This cursors known as ref cursor. Basically ref cursors are devided into 2 categories. 1. Strong cursor 2. Week cursor strong cursor means whose return type is specified week cursor means whose return type is not specified the syntax for a ref_cursor type is: type ref_cursor_name is ref cursor [return record_type]; for strong cursor: type type_name ref cursor return cursor_name%emp.empno; for week cursor: type type_name ref cursor;
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Parameters passing in packages in Interfaces nishank31 Oracle Apps 2 10-15-2008 06:20 AM
Cursors in PL/SQL joel Oracle 4 07-21-2008 04:05 PM
Cursors in packages babi_geek Oracle 5 06-13-2008 02:39 AM
info on pay packages simar_3391 Companies 4 08-04-2007 11:23 AM
How is SAP different from other ERP packages? Geek_Guest SAP R/3 0 07-07-2007 10:40 AM


All times are GMT -4. The time now is 06:14 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved