Re: Using Cursors in a Transaction Processing
Date: Wed, 06 Feb 2002 00:04:21 GMT
Message-ID: <3c6072ea.29940902_at_news.gte.net>
On 29 Jan 2002 05:01:33 -0800, mrussell_at_beeb.net (Michael Russell)
wrote:
>I'm converting a "legacy" application from ISAM-based files to an
>RDBMS. Currently, parts of the application would have an "update-loop"
>based on the sequence of records returned via an index; records will
>be re-written or deleted, then the next record in the path of the
>index will be processed, and so on. Always within a begin-end
>transaction.
>
>To emulate the keyed sequence's retrieval via an ISAM index, I'd
>expected to use "cursors" from within the application programs using
>the RDBMS. However, my primary reference text at the moment, "SQL: The
>Complete Reference" by Groff & Weinberg, says p.540: "COMMIT and
>ROLLBACK statements automatically close all open cursors".
Well here's the thing -- probably 99% of the stuff you do with
relational databases should never involve a cursor at all. If you
find yourself using a cursor more than that, you are almost certainly
doing things the hard way, the slow way, and, dare I say it, the wrong
way. You don't want to emulate an old ISAM system function for
function using cursors in a relational database.
Joshua Stern