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: SQL Default Return

Re: SQL Default Return

From: Isa <isapmon_at_terra.es>
Date: Wed, 26 Feb 2003 11:12:35 GMT
Message-ID: <Di17a.738273$Ye7.4804421@telenews.teleline.es>


Hi:

The decode works fine if the select returns rows.

 SELECT DECODE(a.date, NULL, 'Date Not Exists', a.date) as Date  FROM CALENDAR
 WHERE date = '01-JAN-2003'
 union
 select 'Date Not Exists'
 from dual
 where 0=(select count(*) FROM CALENDAR WHERE date = '01-JAN-2003')

I hope it's usefull to you.
Regards,

                               Isa


"abc" <abc_at_abc.com.au> escribió en el mensaje news:b3h2lq$dcq$1_at_mws-stat-syd.cdn.telstra.com.au...
> Hi,
>
> I have a simple SQL
>
> SELECT DECODE(a.date, NULL, 'Date Not Exists', a.date) as Date FROM
CALENDAR
> WHERE date = '01-JAN-2003'
>
> '01-JAN-2003' is not in CALENDAR Table then I must expect a Default return
> as 'Date Not Exists'. But that doesn't work.
>
> Anyone knows how to get this Default Return if No rows return.
>
> Thanks
>
>
Received on Wed Feb 26 2003 - 05:12:35 CST

Original text of this message

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