Try this.

select empcode, empname, sal, 
decode(to_char(trunc((nvl(sal,0)+1)/5001)),'0','A','B') NewCol
from emp 
/

    ----- Original Message ----- 
To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 1:40 PM


> Hi Gurus
> I have following data in table emp
> empcode  empname   SAL
> a001     XXXXX     2000
> b001     YYYYY     4000
> c001     AAAAA     5000
> d001     CCCCC     8000
> If sal is >=5000 there will be another columns grade and print A else B
> The outout would be like
> empcode  empname   SAL    Grade
> a001     XXXXX     2000    B
> b001     YYYYY     4000    B
> c001     AAAAA     5000    A
> d001     CCCCC     8000    A
> Please help how can i write such query.
> Thanks
> -Seema
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Seema Singh
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Allan Davis Sahadeo
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to