2012-03-30 57 views
2

我在mysql中存储过程。该过程被创建,但是当程序被称为我得到一个错误:mysql中使用存储过程更新表

"Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor -> Query Editor and reconnect."

下面是该过程:

------------------------------------------------ 
drop procedure if exists update_per_det; 

delimiter // 

create procedure update_per_det(IN name varchar(30)) 

begin 

DECLARE age1 int; 

set age1=(select CalAge(name)); 

update per_det set age=age1 where username=name; 

end;// 

delimiter ; 

我怎样才能解决这个问题呢?

+0

请了解如何格式化报价,代码等阅读常见问题以获取更多信息。 – JonH 2012-03-30 13:37:19

回答

2

试试这个:

set age1=(select CalAge(name)); 

SET SQL_SAFE_UPDATES=0; 

update per_det set age=age1 where username=name; 
+0

谢谢你rs.its工作 – mani 2012-03-30 13:43:18

+0

如果它解决了你的问题/问题,请接受我的文章作为答案。 http://meta.stackexchange.com/a/5235 – 2012-03-30 13:47:25