Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sql query

Re: Sql query

From: andrewst <member14183_at_dbforums.com>
Date: Tue, 13 May 2003 11:54:19 +0000
Message-ID: <2872658.1052826859@dbforums.com>

Originally posted by Guido Konsolke
> the (obvious) error is: using SELECT in the DECODE.
> It's simply not allowed.
>

Oh yes it is!

SQL> select deptno,
  2 decode((select count(*) from emp where   emp.deptno=dept.deptno),

  3                1,'one',2,'two',3,'three','more')
  4* from dept
SQL> /     DEPTNO DECOD
---------- -----
        10 three
        20 more
        30 more
        40 more

--
Posted via http://dbforums.com
Received on Tue May 13 2003 - 06:54:19 CDT

Original text of this message

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