Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: An Interesting Question ....
Ronak Bhatt wrote:
>
> Hi,
>
> I have a table as follows
>
> dept_code dept_name
> ------ --------
> 010 Default
> 020 Acct
> 030 Purchase
>
> I want dept_name from this table for a dept_code.
>
> If that dept_ccode doesn't exist in table, it should return dept_name
> of default
> deptcd i.e. '010'.
>
> Can U try ??
>
> Thanks in advance, Ronak
>
> PS : I don't need pl/sql. Only SQL statement.
>
> --
> Greatest Source Of Energy Is To Take Pride In What You Are Doing !!!!
SELECT DEOCDE(DEPT_CODE,'010', 'DEFAULT','020', 'ACCT', '030', 'PURCHASE, 'DEFAULT') FROM DEPT; HOPE THIS HELPS AMARENDRA
-- ************************************************************************ AMARENDRA B NETTEM 5039 N E River Road, Apt. 1A Certified Oracle DBA NORRIDGE, IL 60656 Whittman-Hart Inc., 311 South Wacker Drive, Suite 3500 Chicago, IL 60606. Ph.No. (708) 583 9870 (H) (312) 913 6758 (W) E-mail:nettama_at_charlie.cns.iit.edu, anettem_at_whittman-hart.com Homepage: http://www.iit.edu/~nettama **********************************************************************Received on Fri Sep 05 1997 - 00:00:00 CDT
![]() |
![]() |