Thread: coalesce?
View Single Post

   
  #2 (permalink)  
Old 02-27-2008, 11:31 AM
Tonkuma
 
Posts: n/a
Default Re: coalesce?


raysefo wrote:
> Hi,
>
> I m trying to use coalesce but i m getting this error below, btw i m
> using db2 8.2.
> what i m doing is;
> ...
> where eh.toblm = coalesce(NULL,eh.toblm)
>
> SQL0206N "NULL " is not valid in the context where it is used.
>

NULL keyword can't use as argument of COALESCE on DB2.

> Actually what i want to do is, get the result of this select statement
> either @id is NOT NULL or NULL! if @id is NULL then all results should
> be displayed!
> ...
> where eh.toblm = coalesce(@id,eh.toblm)

How about this?
....
WHERE @id IS NULL

Reply With Quote