mysql - What is wrong with the syntax in this stored procedure? -
delimiter;; create procedure rowperrow() begin declare n int default 0; declare int default 0; declare j int default 0; select count(*) jos_downloads_files n; set j=0; set i=0; while i<n insert jos_downloads_files_temp(id,filetitle,filetype) select distinct t.id, t.filetitle, t.filetype jos_downloads_files t left join jos_downloads_files t2 on t.filetitle != t2.filetitle t.filetitle concat('%', t2.filetitle, '%') , t.filetype 'pdf' union select distinct t2.id, t2.filetitle, t2.filetype jos_downloads_files t left join jos_downloads_files t2 on t.filetitle != t2.filetitle t.filetitle concat('%', t2.filetitle, '%') , t.filetype 'pdf' order filetitle, filetype limit j,2; set @myvar := (select filetitle jos_downloads_files_temp filetype 'pdf'); set @dwg := (select id jos_downloads_files_temp filetype 'dwg'); update jos_downloads_files set filetitle = @myvar filetype 'dwg' , id=@dwg , filetitle!=@myvar; truncate table jos_downloads_files_temp; set = + 1; set j = j + 2; end while; end; ;; results in this:
error
sql query:
create procedure rowperrow() begin declare n int default 0; mysql said: documentation
1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near '' @ line 3
Comments
Post a Comment