MySql 中的警告 1072 - 键列“名称”表中不存在`
收到警告 0 行受影响,1 条警告: 1072 表中不存在键列“名称”
我不知道这是什么意思。有人有解释吗?
表/SP如下
CREATE TABLE IF NOT EXISTS `sectors`
(
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`sector` VARCHAR(25) NOT NULL ,
--
PRIMARY KEY (`id`) ,
UNIQUE INDEX `sector_idx` USING BTREE (`sector` ASC)
);
DELIMITER $$
CREATE PROCEDURE `AddSector` (IN sector VARCHAR(25),
OUT result BOOLEAN)
MODIFIES SQL DATA
BEGIN
DECLARE CONTINUE HANDLER FOR SQLWARNING, SQLEXCEPTION SET result = FALSE;
SET result = TRUE;
--
INSERT INTO `sectors` (`sector`) VALUES (sector);
COMMIT;
END $$
Getting the warning 0 row(s) affected, 1 warning(s):
And I do not know what it means. Does anybody have an explaination?
1072 Key column 'name' doesn't exist in table
The table/SP is as follows
CREATE TABLE IF NOT EXISTS `sectors`
(
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
`sector` VARCHAR(25) NOT NULL ,
--
PRIMARY KEY (`id`) ,
UNIQUE INDEX `sector_idx` USING BTREE (`sector` ASC)
);
DELIMITER $
CREATE PROCEDURE `AddSector` (IN sector VARCHAR(25),
OUT result BOOLEAN)
MODIFIES SQL DATA
BEGIN
DECLARE CONTINUE HANDLER FOR SQLWARNING, SQLEXCEPTION SET result = FALSE;
SET result = TRUE;
--
INSERT INTO `sectors` (`sector`) VALUES (sector);
COMMIT;
END $
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将过程更改为:
存储过程中的所有内容都已在隐式事务中运行,因此不需要提交,并且实际上可能是错误(不确定)。
分隔符;
Change the procedure to:
All stuff inside a stored proc is already run inside an implicit transaction, so the commit is not needed, and may actually be an error (not sure).
DELIMITER ;