MySQL Forums
Forum List  »  Microsoft SQL Server

Re: Test for a NULL variable
Posted by: Roland Bouman
Date: August 23, 2005 06:22AM

This was answered here

http://forums.mysql.com/read.php?60,40208,40208#msg-40208

but the IF...THEN...END IF; construct explained there i particularly useful if you want to conditionally execute a (list of) statements. If you want to drive an expressions value according to the 'NULLness' of another expression, you can use:

COALESCE(arg1,arg2[,argn]) : returns the first not null argument
IFNULL(input,<output if input IS NULL>)

of course,

expr IS NULL

is also valid in stuff like:

IF (expr IS NULL, <output if null>, <output if not null>)
and
CASE
WHEN expr IS NULL THEN <output if null>
ELSE <output if not null>
END

for more info see:

http://dev.mysql.com/doc/mysql/en/control-flow-functions.html

Options: ReplyQuote


Subject
Written By
Posted
August 22, 2005 03:29PM
Re: Test for a NULL variable
August 23, 2005 06:22AM


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.