MySQL Forums
Forum List  »  Newbie

A problem with IFstatement.
Posted by: orderil orderil
Date: July 26, 2005 04:45AM

Hi ALL
Could anyone help me please?

When I try to execute in MySQL Query Browser (version 1.1.9) such a script:

-- **********************************************
SET @hadValue:=0;
SELECT @hadValue:=1 FROM TABLE_NAME WHERE FIELD_NAME='some value';

IF @hadValue=0 THEN
/* do something */
END IF
-- **********************************************

it fails saying:
Your have an error in your SQL syntax: check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF @hadValue=0 THEN
/* do something */
END IF' at line 1


I cannot understand what is wrong.

Options: ReplyQuote


Subject
Written By
Posted
A problem with IFstatement.
July 26, 2005 04:45AM


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.