Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: select in a loop
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.orgReceived on Wed Jul 11 2007 - 11:18:45 CDT
![]() |
![]() |