CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Sponsored Links

Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS ORACLE PL-SQL DETAILS
    Question :
    State the advantage and disadvantage of Cursor?


    Category PL-SQL Interview Questions
    Rating (0.4) By 1332 users
    Added on 8/18/2006
    Views 8458
    Rate it!
    Answers:

    Advantage :

    In pl/sql if you want perform some actions more than one records you should user these cursors only. bye using these cursors you process the query records. you can easily move the records and you can exit from procedure when you required by using cursor attributes.

    disadvantage:

    using implicit/explicit cursors are depended by sutiation. if the result set is les than 50 or 100 records it is better to go for implicit cursors. if the result set is large then you should use exlicit cursors. other wise it will put burdon on cpu.



    Disadvantage:
    Each time we fetch a row from the cursor, it result a network round trip, where as a normal select statement query make only one round trip.



    Posted by: Praveen Jindal    

    Contact Praveen Jindal Contact Praveen Jindal

    The guy's answer at the top of this page about "Cursors" is probably not wrong but sounds wrong and it is hard to understand, it sounds like he has tried to type the answer in english but it is shameful, his english is totally broken, it is bad. You guys at coolinterview.com should do something about such posting to keep up the readership.



    Posted by: good programmer    

    Contact good programmer Contact good programmer

    Advantage of cursor
    1.Basically cursor is a logical place or it is active set.
    when a single query returns more than one rows in that case we can use the cursor. we don't need hit the database several time. Cursor
    always points the latest rows.

    Disadvantage of cursor
    1.As such there is no disadvantage
    of cursor.



    Posted by: sudipta das    

    Contact sudipta das Contact sudipta das

    Advantages:
    Cursors are somewhat like Pointers of Oracle, Oracle executes a query and assign some name to that memory location, which is known as Cursor.
    Cursors are used for storing data temperarorily.
    Cursors are used for storing, managing and retrieving data.
    Cursors stores in the RAM so the data access and retrieval is fast.

    Disadvantage:
    No such disadvantage. Only thing is that rather than storing data in an intermediate variable and fetching it one by one via cursor and then processing it sequentially, we can use Collections. By using collections, we can pass the bundle of Data at once.



    Posted by: Sachin Nagpal    

    Contact Sachin Nagpal Contact Sachin Nagpal

    Cursors adv:
    easier to retrieve a batch of records into the cursor and then perform manipulations on them before displaying the results.

    Disadvantage:
    The biggest disadvantage of cursors is that they eat up you RAM. If you're retrieving a large number of records into your cursor inside a procedure on an OLAP database, it will take a long long time to execute that procedure. The better alternative would be to retrieve directly from one or more table using selection criteria to eliminate records, and perform manipulation on each record on the fly.



    Posted by: HarshDeep Singh    

    Contact HarshDeep Singh Contact HarshDeep Singh

    cursor is nothing but it's a memory area of executing sql or oracle statements.
    Advantage:
    1. We can retrieve more than one record by one query.
    2. It's use our RAM so retrieval is fast.
    3. By using Collection we can retrieve the bundle of data in cursor.

    Disadvantage:
    No such of disadvantage of cursor. When we use cursor one thing is necessary. When I have select only 50 or 100 rows we should use implicit cursor and when more record then we should use Explicit cursor.



    Posted by: Amit Singh    

    Contact Amit Singh Contact Amit Singh

    Everything written above regarding cursor is right, apart from that i wan't to add few more points.

    1) A cursor is a oracle variable.
    2) It is similar to a 2D Array.
    3) It is used for storing (temporarily) multiple records for processing and handling multiple records.
    4) It is a forward only and read only variable type.

    Disadvantage.

    As such there is no disadvantage but if the table data in the cursor is huge then there may be performance issues.
    Instead if possible use joins rather than cursors.



    Posted by: Ashish Khudlani    

    Contact Ashish Khudlani Contact Ashish Khudlani

    cursor is nothing but it's a memory area of executing sql or oracle statements.
    Advantage:
    1. We can retrieve more than one record by one query.
    2. It's use our RAM so retrieval is fast.
    3. By using Collection we can retrieve the bundle of data in cursor.

    Disadvantage:
    No such of disadvantage of cursor. When we use cursor one thing is necessary. When I have select only 50 or 100 rows we should use implicit cursor and when more record then we should use Explicit cursor.



    Posted by: narendra    

    Contact narendra Contact narendra

    advantage:
    1.name this work area
    2.access their stored information
    3.process multiple records
    disadvantage:
    1.variable can be define declare section of pl/sql block
    2.valid in pl/sql block only



    Posted by: hanumantha reddy.d    

    Contact hanumantha reddy.d Contact hanumantha reddy.d

    hi i am a new learner of plsql.i am facing more difficult to understand which answer is correct among no of answers which are different.so pls help me



    Posted by: govind    

    Contact govind Contact govind

    hi , i am new learner of plsql, in above answers one friend said cursor eats RAM, i think cursor is not going to eat RAM, cursor fetch records and put in result set with limited number, lets see the example, if result set has 1000 records , it will fetch 0-100 one time,101-200 second time, like this 901-1000 , so it is not going to create burden on RAM.



    Posted by: naresh    

    Contact naresh Contact naresh

    Cursors act on batches of data (defined by FETCH cursor_name into variable LIMIT 10000).Here the batch size is 10000. So instead of acting on the total dataset, they retrieve a partial batch of data, process the batch and do a commit; Thereby improving performance. Cursors improve I/O network and memory management since the whole data could not be processed at once because of resource availabilty.

    disadvantage:
    users need to know the pl/sql



    Posted by: Anand    

    Contact Anand Contact Anand

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    State the difference between implicit and explicit cursor's.

    View Answer
    What is difference between stored procedures and application procedures,stored function and application function?

    View Answer
    Explian rowid,rownum?What are the pseduocolumns we have?

    View Answer
    1)What is the starting "oracle error number"?
    2)What is meant by forward declaration in functions?

    View Answer
    In a Distributed Database System Can we execute two queries simultaneously ? Justify ?

    View Answer
    How we can create a table in PL/SQL block. insert records into it??? is it possible by some procedure or function?? please give example...

    View Answer
    How to avoid using cursors? What to use instead of cursor and in what cases to do so?

    View Answer
    How to disable multiple triggers of a table at at a time?

    View Answer
    Can we declare a column having number data type and its scale is larger than pricesion
    ex: column_name NUMBER(10,100),
    column_name NUMBAER(10,-84)

    View Answer
    What are the Restrictions on Cursor Variables?
    View Answer
    What will the Output for this Coding?
    Declare
    Cursor c1 is select * from emp FORUPDATE;
    Z c1%rowtype;
    Begin
    Open C1;
    Fetch c1 into Z;
    Commit;
    Fetch c1 in to Z;
    end;


    View Answer
    What is PL/SQL ?
    View Answer
    What is the basic structure of PL/SQL ?
    View Answer
    What are the components of a PL/SQL block ?
    View Answer
    What are the components of a PL/SQL Block ?
    View Answer
    What are the datatypes a available in PL/SQL ?
    View Answer
    What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?
    View Answer
    What is difference between % ROWTYPE and TYPE RECORD ?
    View Answer
    What is PL/SQL table ?
    View Answer
    What is a cursor ? Why Cursor is required ?
    View Answer


    Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

    View ALL PL-SQL Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2014 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions

    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | C Interview Questions & Answers

    Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes


    Cache = 0 Seconds