Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: A job for two cursors?
Ubiquitous wrote:
>I have a situation I am pondering the solution to without much
>success. Maybe someone can offer some pointers. :-)
>
>I have a table containing itemized transactions (Fee Detail) and
>another containing a summary records of these transactions
>that came from a bank (Closeout). I wish to build records in a third
>table based on the summary table, then add the itemized lines
>to it (pulled from the itemized table. The tables would look something
>like this (yes, I know it's not normalized *grin*):
>
>Closeout:
>Key
>summary information
>etc
>
>Fee Detail:
>Key
>Line
>Line information
>
>Itemized
>Key
>Line
>Summary information
>Line information
>
>
>How is the best way to go about doing this?
>
>I am thinking of using a cursor FOR LOOP to insert the new Closeout
>rows into the third table (as line 1), then using a second cursor
>within that loop to pull the associated rows from Fee Detail and then
>insert them as lines 2 thru whatever, inside of an innner curser
>FOR LOOP. Does this sound reasonable or am I making things far too
>complicated?
>
>
What you are proposing is not complicated but it may be unnecessary. If
you can replace the inner cursor
loop with a simple SQL statement using an implicit cursor it will be
much faster. And I don't see from your
description any reason that would justify using a cursor to do what an
INSERT or UPDATE statement
could do far more efficiently.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Tue Oct 07 2003 - 21:50:41 CDT
![]() |
![]() |