Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Decode inside cursor fails: PLS-00320
I don't believe you can use the decode function inside of a stored procedure. You can, however, use it in a view. I would try creating a view with the decode function, then declaring the cursor against the view. I'm not sure this will work, but give it a try.
Good luck,
Dave
stevec_at_zimmer.csufresno.edu wrote in message
<6ev4p2$rgr$1_at_nnrp1.dejanews.com>...
>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
Received on Sat Mar 21 1998 - 00:00:00 CST