Re: cursor loops
From: Norman Dunbar <oracle_at_dunbar-it.co.uk>
Date: Wed, 30 May 2012 16:54:53 +0100
Message-ID: <4FC642CD.9000105_at_dunbar-it.co.uk>
Evening Lyall,
> My developers at our shop have issues with learning new stuff. When i say "new", i really mean old... Implicit cursors haven't even been discovered by them yet. Anyways, what would be a good way of having a cursor, trying to find out if there's anything in it, doing one specific thing if there is, then loop and doing same thing over and over?
> Here's current code/way of doing it:
Date: Wed, 30 May 2012 16:54:53 +0100
Message-ID: <4FC642CD.9000105_at_dunbar-it.co.uk>
Evening Lyall,
On 30/05/12 16:12, Lyall Barbour wrote:
> Hello everyone,
> My developers at our shop have issues with learning new stuff. When i say "new", i really mean old... Implicit cursors haven't even been discovered by them yet. Anyways, what would be a good way of having a cursor, trying to find out if there's anything in it, doing one specific thing if there is, then loop and doing same thing over and over?
> Here's current code/way of doing it:
I suppose you could get them to use collections, BULK COLLECT and FORALL or a loop around the BULK COLLECTed collection from collection.first .. collection.last? Of course, if there are lots of rows returned by the cursor, you may need to think about a LIMIT clause on the BULK COLLECT.
That might/should "freak them out" a little!
I refer you to Steven Feuerstein's excellent tome PL/SQL Programming for details on anything and everything PL/SQL.
Cheers,
Norm
-- Norman Dunbar Dunbar IT Consultants Ltd Registered address: Thorpe House 61 Richardshaw Lane Pudsey West Yorkshire United Kingdom LS28 7EL Company Number: 05132767 -- http://www.freelists.org/webpage/oracle-lReceived on Wed May 30 2012 - 10:54:53 CDT