0

我有这个存储过程:

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    |                |
+--------------------+---------+------+-----+---------+----------------+
4

1 回答 1

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 ;
于 2013-10-23T04:48:06.783 回答