Re: Does Oracle encourage developers to use cursors?

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Sat, 27 Oct 2012 11:36:04 +0100
Message-ID: <qfGdndK_Hv1BJRbNnZ2dnUVZ8mCdnZ2d_at_bt.com>


  • Original Message ----- From: "Harry Tuttle" <SOZRBLNTLEEE_at_spammotel.com>
    |
    | But isn't any result that is returned to the client technically some kind
    of "cursor"?
    |

Yes - some kind. (At least, when thinking of select statements).

| The server has to built up a cursor and then return the rows in there to
the client.

This demonstrates why it's worth asking about SQL Server "cursors". For simple select statements there isn't a "there" for rows to be "in" - they are acquired dynamically and read-consistently as needed. A cursor, in Oracle, is not a pre-built result set waiting to be transferred to the client. If that is the implementation in SQL Server then that's one reason why cursors may (sometimes) be less efficient than one might hope. (Select for update, and some selects with order by or group by clauses may require completely pre-built result sets to be acquired, of course.)

Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com/all_postings

Author: Oracle Core (Apress 2011)
http://www.apress.com/9781430239543 Received on Sat Oct 27 2012 - 12:36:04 CEST

Original text of this message