Alex Rivera | Logout

IsNull function in DB2 SQL?

Asked 2008-09-15T17:47:43.333
20

Is there a performant equivalent to the isnull function for DB2?

Imagine some of our products are internal, so they don't have names:

Select product.id, isnull(product.name, "Internal) 
From product

Might return:

1 Socks 
2 Shoes 
3 Internal 
4 Pants
Edit
Report

1 Answer

3

I'm not familiar with DB2, but have you tried COALESCE?

ie:


SELECT Product.ID, COALESCE(product.Name, "Internal") AS ProductName
FROM Product
answered 2008-09-15T17:52:25.240

Your Answer