MySQL Forums
Forum List  »  Microsoft SQL Server

Re: In Stored Procedure, how to check if variable is NULL?
Posted by: Roland Bouman
Date: August 22, 2005 04:02PM

Sorry, the snippet from my previous post should read:

IF
l_UserID IS NULL
THEN
SELECT FirstName, LastName, EMail FROM Users WHERE UserID = l_UserID;
END IF;


so, the full pattern is:

IF <condition> THEN
<statements>
END IF;

as for the condition,

<expr> IS NULL

is an ordinary valid condition, even ;) in IF..THEN..END IF statements.

See:

http://dev.mysql.com/doc/mysql/en/if-statement.html

Options: ReplyQuote




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.