MySQL Forums
Forum List  »  Triggers

Re: nvl
Posted by: Roland Bouman
Date: December 14, 2005 04:50PM

use either one of:

COALESCE (http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html)
or
IFNULL (http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html)

select COALESCE(supplier_city, 'n/a')
, IFNULL(supplier_city, 'n/a')
from suppliers;

if you don't trust that, you can also use:


select IF(supplier_city IS NULL, 'n/a',supplier_city)
from suppliers;

or the good old CASE:

select CASE WHEN supplier_city IS NULL THEN 'n/a' ELSE supplier_city END
from suppliers;

Options: ReplyQuote


Subject
Views
Written By
Posted
nvl
94543
December 14, 2005 04:28PM
Re: nvl
47102
December 14, 2005 04:50PM
14418
July 03, 2006 11:50PM
12321
July 04, 2006 01:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.