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: PL/SQL problem

Re: PL/SQL problem

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 6 Feb 2003 10:48:25 GMT
Message-ID: <b1tehp$16puhd$2@ID-82536.news.dfncis.de>

> Jan Gelbrich wrote:
>

>> DECODE can only be used in a SQL statement, but not within PL/SQL.
>> Source: Oracle SQL Reference by Kreines & Jacobs, O´Reilly.

>
> Bull.
>
> SQL> create or replace procedure xtest as
> 2 x varchar2(20);
> 3 begin
> 4 select decode('xxx', '1', '1', '2' ) into x from dual;
> 5* end;
> SQL> /
>
> Procedure created.
>
> SQL> show errors
> No errors.
> SQL>
DECODE cannot be used like a function in PL/SQL:

SQL> create or replace procedure test_ as   2 v_ varchar2(20);
  3 begin
  4 v_:=decode('aha','AHA','yes','no');   5 dbms_output.put_line(v_);
  6 end;
  7 /

Warning: Procedure created with compilation errors.

SQL> show errors
Errors for PROCEDURE TEST_:

LINE/COL ERROR

-------- -----------------------------------------------------------------
4/3      PL/SQL: Statement ignored
4/7      PLS-00204: function or pseudo-column 'DECODE' may be used inside
         a SQL statement only


I presume, that was the original meaning

Rene Nyffenegger

-- 
  no sig today
Received on Thu Feb 06 2003 - 04:48:25 CST

Original text of this message

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