Job Seekers   Employers
dbapool: Authors | Submissions | Contact Us
   Forgot password? | Sign up
  Home   Discussion Forum   Articles   Interview Questions   FAQs   Scripts   Rewards   Analyzer   White Papers   Blog   Certification   Downloads   Tools
 

Topic: SQL*Plus and PL/SQL >> cursors

Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property. You may review the entire Oracle Certification Program Candidate Agreement online Here.



  


 Title: cursors
 mohan  Posted: Apr 20, 2007 08:54:53 PM

 Total Post: 2
 Joined: Apr, 2007






 Hi,

When use explict and Implict cursor and what is the prons and crons of two.It should be appereciate if any one with examples

Thanks and Regards,
Mohan

 priya
Posted: Apr 21, 2007 07:27:42 AM  

 Total Post: 39
 Joined: Apr, 2007






 
hi,

The implicit cursors are used for all DML statements and SELECT statements in PL/SQL. And this implicit cursors are used for single row queries.

The explicit cursors are used for all the queries which operate on multiple rows.

Thanks
priya

 mohan
Posted: Apr 21, 2007 08:26:02 PM  

 Total Post: 2
 Joined: Apr, 2007






 
Hi,
Thanks for your reply

Regards,
Mohan

 Rush
Posted: Apr 23, 2007 12:30:27 AM  

 Total Post: 127
 Joined: Jan, 2007






 
hi dear,
i want to give you some basic and clear concept of cursor whatever i know.
Q:what is cursor?
a:cursor is buffer area of oracle where single or multiple records are fetched.

Q:why do we need cursor?
a:when we do any query then this area is automatically created by oracle.but can you fetch multiple records through pl/sql? no! so to do this we need to create cursor manualy.thus there are two types of cursor
a)implisite:-created by oracle
b)explisite:-created by programer when there is need to fetch more than one record through pl/sql.
Q:what are attributes of cursor?
a:there are four type of attribute of each cursor(impl as well as expl)
1)%found
2)%not found
3)%is open
4)%row count
*there are other cursor also such as
1)cursor with for loop
2)ref cursor
example:we have to feth all the record of emp table through pl/sql
sol:because records are mor than one so we need expl cursor

declare
demp emp%rowtype
cursor c1 is select * from emp into demp;
begin
c c1;
open c1;
loop
.
.
.
dbms_output.put_line(c.ename||......);

exit when c1%not found;
end loop;
close c1;
end;
/
above examle is jut to show you how to write a cursor
if you want more on this then plz write me on gullu02@gmail.com

hope you will find it valuable :)

RUPESH

 yash
Posted: May 18, 2007 11:49:18 AM  

 Total Post: 16
 Joined: Jan, 2007






 
hiii
U know the cursor is comes in oracle , I during execution there is 2 type of by which u can update date
1>Batch processing(in this data is update in regluar interwal)
2>Runtime prcessing( in this mode data is update with time )

but the oracle is Batch prcessing, coz if cursor is not in pic. Performance of system well decrease it’s make very time take process. When define cursor we just select the virtual memory for the store the result . every time when u run query data is populated in sql private memory area(active set or virtual memory)
the operation performe during is that
1>define a cursor
2>open the cursor
3>fetch operation
4>close operation
when u open the cusor that mean u define the active set where result is comes or u can say that result going in active set .
after this fetch operation is doen that important part here u r give the pointer to at the 1st position during the fetch operation it’s goes to next postion when it’ read 1st row or data
if u r not doing fecth just tink about., ur cursor pointer heat ur database each time ,that mean pointer going to each time to ur data base that mean it’ decreae ur performance & it’s very time take prcpcess.. that way the cursor comes in oracle…….



 yash
Posted: May 18, 2007 11:51:43 AM  

 Total Post: 16
 Joined: Jan, 2007






 
hiii
U know why the cursor is comes in oracle , during execution of query there is 2 type of update of data is happen......
1>Batch processing(in this data is update in regluar interwal)
2>Runtime prcessing( in this mode data is update with time )

but the oracle is use Batch prcessing, coz if cursor is not in pic. Performance of system well decrease it’s make very time take process. When define cursor we just select the virtual memory for the store the result . every time when u run query data is populated in sql private memory area(active set or virtual memory)
the operation performe during is that
1>define a cursor
2>open the cursor
3>fetch operation
4>close operation
when u open the cusor that mean u define the active set where result is comes or u can say that result going in active set .
after this fetch operation is doen that important part here u r give the pointer to at the 1st position during the fetch operation it’s goes to next postion when it’ read 1st row or data
if u r not doing fecth just tink about., ur cursor pointer heat ur database each time ,that mean pointer going to each time to ur data base that mean it’ decreae ur performance & it’s very time take prcpcess.. that way the cursor comes in oracle…….



 Time Zone: EDT

  




Forum Rules & Description


Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user




 








Get FREE Magazines

Top 10 Forum User

  Murtuja Khokhar857
  Mohammed Taj746
  positive fanatic483
  Jayanta Sur479
  Vigyan Kaushik386
  Gopu Gopi335
  Gitesh Trivedi322
  Vinoth Kumar264
  neeraj sharma258
  Ramesh Jois246






oracle Mag



  About Us Advertise Terms of Use Privacy Newsletters Contact Us    

Home   Discussion Forum   FAQs  Articles  Jobs   Newsletters  Directory  Downloads 

Our Premium Sponsor
Confio Software