在调试mysql的存储过程是,添加一条delete语句时报如下错:
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.
解决办法:
在delete语句前添加:
SET SQL_SAFE_UPDATES = 0;
例如:
SET SQL_SAFE_UPDATES = 0;
delete from db_sys_stat.t_table_stat1 where table_schema=v_schema and table_name=v_tabname
and DATE_FORMAT(create_time,'%Y%m%d')=CURDATE();
调试即可通过!