Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: select in a loop

Re: select in a loop

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 11 Jul 2007 09:18:45 -0700
Message-ID: <1184170724.286019@bubbleator.drizzle.com>


alexander.stuckenholz_at_fernuni-hagen.de wrote:
> Hello everyone,
>
> I just started with PL/Sql and directly have a problem. I want to
> iterate in a loop and use an entry in a where-statement of a pretty
> complex query.
>
> I did the following:
>
> BEGIN
> FOR item IN
> (
> SELECT * FROM test
> )
> LOOP
> select * from (pretty complex subquetries...) where something.id =
> item.id
> END LOOP;
> END;
>
> Unfortunately this does not seem to work. Does anybody of you have an
> idea?
>
> Best regards,
>
> Alex

Your abuse of Sybrand's serious attempt to help you was unwarranted.

That said ... self-taught PL/SQL programming is doomed, at best, to mediocrity. Get copies of Tom Kyte's books and use the demos in Morgan's Library at www.psoug.org to find working examples of proper syntax.

In your case, based on what you've written any looping structure is a mistake. If the actual code does justify a loop then look up array processing with BULK COLLECT and FORALL.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Wed Jul 11 2007 - 11:18:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US