create procedure p_AddArtisType(isAdd int,aId varchar(50),tIds varchar(500) )
BEGIN
if isAdd=1 then
if tIds!='' then
set @updatesql =CONCAT(' insert into artiststype(AId,TId,IdPath,NamePath) select ',aId,',ID,FullID,FullName from t_part_info where ID in(',tIds,')');
PREPARE sqltext from @updatesql;
execute sqltext;
end if;
else
if tIds!='' then
delete from artiststype where AId=cast(aId as unsigned);
commit;
/*
set @updatesql =CONCAT('insert into artiststype(AId,TId,IdPath,NamePath) select ',aId,',ID,FullID,FullName from t_part_info where ID in(',tIds,');');
PREPARE sqltext from @updatesql;
execute sqltext;
*/
end if;
end if;
END
执行 call p_AddArtisType(0,'10','15,16')
结果把所有数据都删除掉。
真被他搞死啦
解决方案 »
- mysql连接提示1135 can't create a new thread (errno 12),求助
- c/c++ 编写存储过程
- 今天被人教育了一把,求真相
- 关于MYSQL的ODBC和ADO访问问题!!!!!谢谢
- 哪里能下载到WIN2K上的mysql?我刚下载的mysql-4.1.0-alpha.zip里面没有setup.exe这个文件?
- 我觉得MySQL control center非常好用。嘻嘻
- 请教mysql所用的数据类型
- 版主快来帮忙,mysql的一个非常紧张的问题,在线等
- 请问怎样在Windows和Linux下访问远程(inter网)MySQL服务?
- Mysql Error 1064
- mysql查询统计的问题,请大家帮我看看,谢谢
- 配置Proxool的时候出现异常Proxool Provider unable to load JAXP configurator file: ProxoolC
create procedure p_AddArtisType(isAdd int,aId1 varchar(50),tIds varchar(500) )
BEGIN
if isAdd=1 then
if tIds!='' then
set @updatesql =CONCAT(' insert into artiststype(AId,TId,IdPath,NamePath) select ',aId,',ID,FullID,FullName from t_part_info where ID in(',tIds,')');
PREPARE sqltext from @updatesql;
execute sqltext;
end if;
else
if tIds!='' then
delete from artiststype where AId=0+aId1;
commit;
/*
set @updatesql =CONCAT('insert into artiststype(AId,TId,IdPath,NamePath) select ',aId,',ID,FullID,FullName from t_part_info where ID in(',tIds,');');
PREPARE sqltext from @updatesql;
execute sqltext;
*/
end if;
end if;
END