IF语法错误 [英] IF syntax error

查看:313
本文介绍了IF语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在遵循 IF 语法的MySQL指南时遇到语法错误。

I'm getting a syntax error while following the MySQL guide for IF syntax.

我的查询是:

if 0=0 then select 'hello world'; end if;

从逻辑上讲,这应该选择'hello world',但我获得

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语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆