我正在研究一个程序,它使用两个准备好的语句将一些数据复制到一个文本文件中(
@aux1
和
@aux2
). 然后在复制信息的表中,get删除所有行。
问题是当我使用
call copyIntoFile()
程序
delimiter !!
drop procedure if exists copyIntoFile !!
create procedure copyIntoFile()
begin
declare path varchar(255);
set path = concat("'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/", curdate(), ".txt'");
set @aux1 = concat("select * from movie_modification where modified = true into outfile ", path,
" fields terminated by ';' lines starting by 'Edit: ' lines terminated by '\n';");
prepare stmt1 from @aux1;
execute stmt1;
deallocate prepare stmt1;
set @aux2 = concat("select * from movie_modification where modified = false into outfile ", path,
" fields terminated by ';' lines starting by 'New: ' lines terminated by '\n';");
prepare stmt2 from @aux2;
execute stmt2;
deallocate prepare stmt2;
delete from movie_modification;
end !!
delimiter ;
(执行过程时)
错误代码:1064。您的SQL语法有错误;请查看与MySQL服务器版本相对应的手册,在第1行的“以“”结尾的行”附近使用正确的语法
如您所见,错误发生在
lines terminated by
(在第1行)。所以现在我想知道我能不能用
行终止于
之后
lines starting by
发生了什么?