Re: SQL Default Return
Date: Wed, 26 Feb 2003 11:12:35 GMT
Message-ID: <Di17a.738273$Ye7.4804421_at_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 - 12:12:35 CET