我有这个存储过程:
DROP PROCEDURE IF EXISTS buildMySomething;
CREATE PROCEDURE buildMySomething()
BEGIN
UPDATE current_amount SET current_m_amount = 2 WHERE m_id = 1;
END //
这给了我以下错误:ERROR 1054 (42S22): Unknowing column 'current_m_amount' in 'field list'
在互联网上浏览后,很明显,如果列不存在,意外字符或语法错误(他们输入的列名错误),人们会收到此错误...但是。 ..我已经无数次检查了这些可能性。我在这里失踪了什么?
+--------------------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+---------+------+-----+---------+----------------+
| m_id | int(11) | NO | PRI | NULL | auto_increment |
| current_m_amount | int(11) | NO | | NULL | |
+--------------------+---------+------+-----+---------+----------------+
答案 0 :(得分:2)
我认为这可能与使用的分隔符有关。试试这个,在我的测试服务器上执行:
DROP PROCEDURE IF EXISTS buildMySomething;
delimiter //
CREATE PROCEDURE buildMySomething()
BEGIN
UPDATE current_amount SET current_m_amount = 2 WHERE m_id = 1;
END //
delimiter ;