I'm getting a syntax error while following the MySQL guide for IF
syntax.
My query is:
if 0=0 then select 'hello world'; end if;
Logically, this should select 'hello world'
, but instead I get
ERROR 1064 (42000): You 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 (0=0) then select 'hello world'' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end if' at line 1
Your query is only valid in a stored procedure/function context. See there for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With