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: Decode inside cursor fails: PLS-00320

Re: Decode inside cursor fails: PLS-00320

From: Matthias Gresz <GreMa_at_t-online.de>
Date: 1998/03/23
Message-ID: <6f5j8j$c1n$2@news00.btx.dtag.de>#1/1

On Fri, 20 Mar 1998 19:24:35 -0600, stevec_at_zimmer.csufresno.edu wrote: Hi,

if you want to alias DECODE(A,'X','0','1') as 'D' just ommit the '"' around 'D':

DROP TABLE T1;
DROP TABLE T2;
CREATE TABLE T1 (A VARCHAR2(1));
CREATE TABLE T2 (A VARCHAR2(1));
DECLARE
   CURSOR C IS

     SELECT NULL FROM
        ( SELECT A
         , DECODE(A,'X','0','1') D
            FROM T1) V1,
       T2
     WHERE V1.A=T2.A;

BEGIN
  NULL;
END;
>Why does the following cursor declaration fail?
>
>DROP TABLE T1;
>DROP TABLE T2;
>CREATE TABLE T1 (A VARCHAR2(1));
>CREATE TABLE T2 (A VARCHAR2(1));
>DECLARE
> CURSOR C IS
> SELECT NULL FROM
> ( SELECT A
> , DECODE(A,'X','0','1') "D"
> FROM T1) V1,
> T2
> WHERE V1.A=T2.A;
>BEGIN
> NULL;
>END;
>.
>/
>
>The above gives the following error in SQL Plus:
> ( SELECT A
> *
>ERROR at line 4:
>ORA-06550: line 4, column 9:
>PLS-00320: the declaration of the type of this expression is incomplete or
>malformed
>
>When I comment the decode line, it works fine. If I don't use the cursor
>declaration, and just pass the select to the server, it works fine. If the
>select is not part of a joined view, it works fine.
>
>This is a greatly simplified version of a big select, but it all works except
>the decode.
>
>I sure hope somebody can give me an answer to this.
>
>Thanks SO MUCH in advance.
>
>Steve Cosner
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
--

Regards

Matthias Gresz    :-)

GreMa_at_T-online.de
Received on Mon Mar 23 1998 - 00:00:00 CST

Original text of this message

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