Subject Re: coalesce and case does not work in firebird 1.5 ??
Author jvpgr
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 07:27 AM 1/11/2008, you wrote:
> >Hi all,
> >
> >any idea why a select like the following
> >
> > select coalesce(work_hours, 0), work_hours,
> > case when work_hours is null then 0 else work_hours end
> > from resource_allocation
> >
> >could return null in all fields ?
>
> If you are using an GUI utility that returns a dummy set to a grid
when the query returns no result, then you would see a row of nulls.
The database server does not send this result: it is manufactured by
your utility program..
>
>
> >I am using firebird 1.5 on an win 2003 server, it's not the first time
> >I am using coalesce and / or case and I did not notice such behaviour
> >till now
>
> Nothing has changed. Check whether your table has data.
>
> ./heLen
>
Helen,

you are right about the GUI tool, the select is in a SP thought, so
the only way I can see to by pass the nulls when the table is empty,
is to check either if it has any records or to convert the result to 0
before ussing it nevermind the coalesce.

Yannis