create procedure delWord_activety()
BEGIN
DECLARE Done INT DEFAULT 0;
DECLARE v_id VARCHAR(50);
DECLARE v_content text;
DECLARE f_content text;
/*声明游标*/
DECLARE rs CURSOR FOR SELECT id,content FROM cms_activity_data_121;
/*异常处理*/
DECLARE CONTINUE HANDLER FOR SQLSTATE ‘02000‘ SET Done=1;
/*打开游标*/
OPEN rs;
/*逐个取出当前记录LingQi字段的值,需要进行最大值的判断*/
FETCH NEXT FROM rs INTO v_id,v_content;
/*遍历数据表*/
REPEAT
IF NOT Done THEN
set v_content=replace(v_content,char(10),‘‘);
set v_content=replace(v_content,char(13),‘‘);
update cms_activity_data set content=v_content where id=v_id;
END IF;
FETCH NEXT FROM rs INTO v_id,v_content;
UNTIL Done END REPEAT;
/*关闭游标*/
CLOSE rs;
end
DROP PROCEDURE delWord_activety
call delWord_activety()
时间: 2024-11-06 10:26:32