Re: Does Oracle encourage developers to use cursors?

From: <zigzagdna_at_yahoo.com>
Date: Fri, 26 Oct 2012 23:43:40 -0700 (PDT)
Message-ID: <3f9010e9-5180-47d2-8767-3ee1321ab59c_at_googlegroups.com>



On Saturday, October 20, 2012 10:59:15 AM UTC-4, gnews..._at_gmail.com wrote:
> I've asked this at asp.net forum, but I think we have more gurus here to get more educational, informative information about my confusion.
>
>
>
> I am new to Oracle, but not new to SQL Server and .NET application development. I think it is a general understanding that we should try to avoid using cursors as much as possible at least with sql server, because it just doesn't perform that well.
>
>
>
> But if we read any Oracle PL/SQL primer, I bet you will be reading about cursors after cursors.
>
>
>
> So, is cursor simply the established practice of Oracle to get our data? Is oracle cursor internally different from that of SQL Server such that it doesn't cause any performance hit?
>
>
>
> Any thoughts? Thank you.

I am an oracle dba/developer and am learning sql server t-sql. I have also read many articles in sql server which sat avoid cursors but I did not find anything in sql server internals which make cursors slow (coming from oracle back ground). I have seen in sql server people avoid cursor based code and then write round about set based code which is even slower than cursor based code!!!! Yes cursor based code is row by row and cannot take advantage of any parallelization, set based code can be parallelized by sql server engine, so it can be more efficient.

However, if your logic is serial; cursor based code is not inefficient!! I do not find anything in sql server internals which makes sql server cursors very inefficient !!! Received on Sat Oct 27 2012 - 08:43:40 CEST

Original text of this message