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: Peter Rak <prak_at_vsz.sk>
Date: 1998/01/09
Message-ID: <34B62646.ECE1930E@vsz.sk>#1/1

Thomas Kyte wrote:

> 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.

  Hi,
But try this one:

declare

    cursor foo is
    select DUMMY from ( select DUMMY from DUAL WHERE UPPER(DUMMY)='Y'); begin

    for x in foo loop

        dbms_output.put_line( x.DUMMY );     end loop;
end;

Why it doesn't work???
I can't use function on column in subquery...

        Peter. Received on Fri Jan 09 1998 - 00:00:00 CST

Original text of this message

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