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

Home -> Community -> Usenet -> c.d.o.server -> Re: subqueries in cursors?

Re: subqueries in cursors?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/01/08
Message-ID: <34b9680a.36471062@inet16>#1/1

On Thu, 08 Jan 1998 17:17:29 GMT, Gerhard.Moeller_at_OFFIS.Uni-Oldenburg.de (Gerhard Moeller) wrote:

>Hi,
>
>I just experienced that there are no subqueries allowed in PL/SQL
>cursors. A Cursor like
>
> CURSOR foo IS
> SELECT bar FROM (SELECT ...) ...
>
>seems not allowed in PL/SQL 2.3.
>
>Is that really true? Why? And how can I work around this elegantly?
>
> Gerhard...

I just ran:

declare

    cursor foo is
    select ename from ( select * from emp ); begin

    for x in foo loop

        dbms_output.put_line( x.ename );     end loop;
end;
/

In a 7.3.3 instance with pl/sql 2.3.3. It ran OK. It is true that in 7.2, the above syntax was not supported with pl/sql only in sql. The workaround in 7.2 was to use dbms_sql to dynamically execute the query. But... in 7.3 it works...  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Jan 08 1998 - 00:00:00 CST

Original text of this message

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