mysql - MySQL代码中END关键字的语法错误问题
问题描述
当一切看起来都很好时,为什么我会收到语法错误。指出了 MySQL 工作台上的错误位置。我检查了很多问题,但没有找到答案。我知道这将是一个小问题,但我无法弄清楚
SELECT * FROM classicmodels.customers;
DELIMITER $$
create function CustomerLevel( credit decimal(10,2))
returns varchar(20) deterministic
begin
declare customerLevel varchar(20);
if (credit > 50000) then set customerLevel = 'PLATINUM';
else if (credit >= 50000 and credit <= 10000) then set customerLevel = 'GOLD';
else IF (credit < 10000) then set customerLevel ='SILVER';
end if;
return (customerLevel);
end; -- this is where the syntax error code is
$$ DELIMITER ;
/*
Error Code: 1064. 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 '' at line 10
*/
```````````````
解决方案
推荐阅读
- java - Android 轻柔地结束不确定的 ProgressBar
- java - 启动时未调用 BroadcastReceiver
- java - 为什么在 HttpServletRequest 中找不到证书?
- postgresql - Docbase 无法连接到文档库内容服务器安装中的数据库错误
- java - 是否可以从 Gradle 中的不及物配置扩展传递配置?
- python-3.x - Leetcode 219. 我的 python 解决方案不起作用
- python - 用于发送命令和接收输出的 Python 服务器套接字(类似 netcat 侦听器)
- wordpress - 我的 category.php 模板中缺少 ACF 选项图像(徽标)
- javascript - 从 div 列表中选择一个 div 并在该 div reactjs 功能组件上切换类
- kotlin - OpenGL中简单矩形碰撞的问题