Re: SQL vs PL/SQL: FROM clause incompatible?

From: Jim Smith <Jim_at_jimsmith.demon.co.uk>
Date: 1995/07/20
Message-ID: <806275467snz_at_jimsmith.demon.co.uk>#1/1


In article <3ugveg$rr5_at_aplinfo.jhuapl.edu>

           pam.smith_at_jhuapl.edu "P. Smith" writes:

> At the bottom is some SQL or PL/SQL that I'm attempting work through.
> I have a select statement whose "FROM" clause is an embedded query.
> It works fine using SQL*PLUS but does not compile when I attempt to
> create a PL/SQL cursor with the same select statement. Any ideas?
> -- the following select statement is accepted by SQL*PLUS
> SELECT var2 FROM
> (SELECT var2, var3 FROM mytable WHERE var1 = 1
> UNION
> SELECT var2, var3 FROM mytable WHERE var1 = 2);
>
>
> -- the following PL/SQL does not compile (**identical select
> statement**))
> CREATE OR REPLACE PROCEDURE myproc IS
>
> CURSOR c1 IS
> SELECT var2 FROM
> (SELECT var2, var3 FROM mytable WHERE var1 = 1
> UNION
> SELECT var2, var3 FROM mytable WHERE var1 = 2);

What versions of Oracle and PL/SQL are you using?

Using a query in the from clause of a query is part of the ANSI 92 standard is to be introduced at version 7.2.x

It you are using 7.2 then there is a PL/SQL bug. If you are using 7.1 then you must have hit on an unsupported feature. If it is introduced in 7.2 the code might well be present in later versions of 7.1 but probably isn't supported.

-- 
Jim Smith
Received on Thu Jul 20 1995 - 00:00:00 CEST

Original text of this message