CREATE PROCEDURE 'substring_pre_map' ()
BEGIN
DECLARE m_unit_map_filename varchar(200);
DECLARE m_str1 int(3);
DECLARE m_str2 int(3);
DECLARE m_flag int(1);
DECLARE cur_title cursor for select unit_map_filename from t_maps_hot;
DECLARE continue handler for not found set m_flag = 1;
open cur_title;
repeat
fetch cur_title into m_unit_map_filename;
begin
m_str1=substring_index(substring_index(m_unit_map_filename,'_',-2),'_',1)+2;
m_str2=substring_index(m_unit_map_filename,'_',-1)+2;
update t_maps_hot set unit_map_filename=concat('pre_map_',m_str1,'_',m_str2) where unit_map_filename=m_unit_map_filename;
end;
until m_flag=1
end repeat;
close cur_title;
end
=============================ERROR============================
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=substring_index(substring_index(m_unit_map_filename,'_',-2),'_',1)+2;
m_s' at line 13
(耗费 0 ms)
我的MYSQL是5.1的
BEGIN
DECLARE m_unit_map_filename varchar(200);
DECLARE m_str1 int(3);
DECLARE m_str2 int(3);
DECLARE m_flag int(1);
DECLARE cur_title cursor for select unit_map_filename from t_maps_hot;
DECLARE continue handler for not found set m_flag = 1;
open cur_title;
repeat
fetch cur_title into m_unit_map_filename;
begin
m_str1=substring_index(substring_index(m_unit_map_filename,'_',-2),'_',1)+2;
m_str2=substring_index(m_unit_map_filename,'_',-1)+2;
update t_maps_hot set unit_map_filename=concat('pre_map_',m_str1,'_',m_str2) where unit_map_filename=m_unit_map_filename;
end;
until m_flag=1
end repeat;
close cur_title;
end
=============================ERROR============================
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=substring_index(substring_index(m_unit_map_filename,'_',-2),'_',1)+2;
m_s' at line 13
(耗费 0 ms)
我的MYSQL是5.1的
解决方案 »
- Out of memory (Needed 65312 bytes)
- 问一个自动执行脚本的问题
- vc++6.0通过ODBC访问MySQL server遇到的问题!!!
- 图书借还关系
- MySQL自定义函数问题?高手请帮忙
- group by一列数据,但是要合并数据,有个函数忘记了,谢谢帮助
- 我有两个销售单表:saletb和salerc,saletb是存储销售单据号和日期的,有said.......
- my.ini里的用户名和密码有什么用 好像登陆数据库的时候也没有用阿?
- MariaDB 排序存在问题
- sql如果表里有这条数据就插入,没有就不插入
- 急!mysql存储过程问题,大家请帮忙下
- select * from 表名 into outfile 是不是不能备份远程数据库?
DECLARE m_str1 varchar(200);
DECLARE m_str2 varchar(200);错误是一样的错误