Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: substitute null values in SQL query?
How about the Oracle builtin NVL. It sounds like what you're looking for.
SELECT NVL(MyColumn, 0)
FROM MyTable
will return the value of column MyColumn if it's not null and 0 if the value returned from the table is NULL. This is evaluated for each record.
Think of it as
IF MyColumn IS NULL THEN
return 0
ELSE
return MyColumn
END IF
type function.
HTH Alan
wykoff_at_my-deja.com wrote in message <7lbn11$vge$1_at_nnrp1.deja.com>...
>Hi,
>
>Once again I need equivalent SQL behavior to an SQL Server query in
>ORACLE.
>
>The value in the select is the difference in dates unless the difference
>returns NULL. In this case it returns 0 (via IsNULL()). I'm looking
>through the SQL Language reference, but I'm not coming up with anything.
>
>Thanks for your help,
>
>kim
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
Received on Wed Jun 30 1999 - 02:55:53 CDT