Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Unanswered: How to avoid cusors

    I heard that when we use cursors in our application performance will be slow.
    So can any one help me what I want to use instead of cursors. What concept is
    there that can do as it is with cursor.


    Thanks and Regards,
    Srinivas.M

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Use standard set based SQL. SELECT, UPDATE, DELETE, INSERT.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    As pootle flump wrote, to get good performance you should write code that manipulates sets instead of rows of data. Doing row processing in SQL is rarely necessary, and it performs very poorly compared to doing set processing.

    There are database systems such as DB2 and Oracle which have evolved from unit-record systems. They are highly optimized for dealing with individual rows of data, and their associated tools rely heavily on cursors (because the engine itself is optimized for dealing with the rows of data). Most SQL engines are optimized for set processing, so they are often handicapped when dealing with individual rows of data.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •