mysql - MySQL 说:#1064 - 你的 SQL 语法有错误;在存储过程中
问题描述
我正在尝试在 phpmyadmin 中创建一个存储过程。例如,我在 PHP MyAdmin 中执行此操作
UPDATE financeplusacct SET bal = bal - 5000 WHERE accNum = 00343297587;
UPDATE financeplusacct SET bal = bal + 5000 WHERE accNum = 00343995977
它可以毫无顾虑地发布,然后我尝试将其设为存储过程,以便我的 Javascript REST api 可以轻松调用它,看起来像这样
UPDATE financeplusacct SET bal = bal - amount WHERE accNum = accNum1;
UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2;
我把它当作一个错误
One or more errors have occurred while processing your request:
The following query has failed: "CREATE DEFINER=`root`@`localhost` PROCEDURE `ExecDebitCredit`(IN `accNum1` VARCHAR(150), IN `accNum2` VARCHAR(150), IN `amount` DECIMAL(18,2)) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER UPDATE financeplusacct SET bal = bal - amount WHERE accNum = accNum1; UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2;"
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2' at line 2
请问有什么我没有得到正确的吗?
解决方案
推荐阅读
- tableau-api - Tableau 中的连续月份显示月份 + 年份
- dart - Dart 应该推断类成员类型吗?
- java - 如何在 Android 的 C# 中使用 ToFileTime?
- javascript - 如何在我的两个 Electron 应用程序窗口上放置主题(暗/亮模式)?
- wordpress - 如何为 WP_Term_Query 分页?
- python - Python Flask - 接收图像作为帖子
- yaml - 为什么无法解析 YAML 元数据?
- python - 创建一个 python 脚本来计算使用 tcpdump 到达网站的数据包数量?
- python - 在页面上找到第二个特定链接文本元素并通过python单击它
- c++ - C ++:无法读取数组中的内容