I am trying to make this expression If Statement, but I cannot get it to do what I want. If I do select @result, it will give me a value of 0, then why the IF statement is not working?
SET @message = '((sometihng here))'; select LEFT(@message, 1) into @firstChar; select STRCMP(@firstChar,'(') into @result; IF (@result = 0) THEN SET @message = 'true'; //more selects and cals here; END IF; select @message;
I have to get the truth, but I am not showing me the error:
SQL query: IF( @result =0 ) THEN SET @message = 'true';
MySQL said:
1064 - You have an error in the SQL syntax; check the manual that matches your version of MySQL server for the correct syntax to use near 'IF (@result = 0) THEN SET @message =' true '' on line 1
source share