Answer
The main purpose that cursors fulfill is traversing of the row set. Cursors can be best avoided by:
a. Using the SQL while loop: Using a while loop we can insert the result set into the temporary table.
b. User defined functions: Cursors are sometimes used to perform some calculation on the resultant row set. This cam also be achieved by creating a user defined function to suit the needs
----------
A while loop will be just as slow as a cursor. Functions have there own performance issues to deal with.
Your best bet is to use a rowbased process instead. There are several cases when cursors are the best option.
If you can provide samples of what you are trying to do better options may be able to be provided.
Last Wiki Answer Submitted: April 26, 2009 4:13 am by Technowise290 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.