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: sybrandb <sybrandb_at_gmail.com>
Date: Wed, 11 Jul 2007 07:11:22 -0700
Message-ID: <1184163082.865702.171440@q75g2000hsh.googlegroups.com>


On Jul 11, 3:40 pm, "alexander.stuckenh..._at_fernuni-hagen.de" <alexander.stuckenh..._at_gmail.com> 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

Yes, several.
First of all I don't see a specific error message. Secondly I don't see a version
Thirdly I don't see any subquery
Fourthly I don't see select into inside the loop, I only see SELECT ending up nowhere
Fifthly, it looks like I see an attempt to develop an unscalable piece of code by rewriting a proper query
select * from (pretty complex queries where something.id in (select item.id from test) into a CURSOR FOR loop. People developing code like that should either learn SQL or be shown to the door of unemployment, and hopefully they will never got a job in a situation, where tired and frustated DBAs are fully occupied to clean out their messes.

--
Sybrand Bakker
Senior Oracle DBA
Received on Wed Jul 11 2007 - 09:11:22 CDT

Original text of this message

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