"Syntax error: missing 'semicolon'" in MySQL procedure

2

I have procedure below

CREATE DEFINER='root'@'localhost' PROCEDURE 'SP_notasAluno'(IN aluno INT)
BEGIN 
  DECLARE ditCodigo,courseId INT;
  DECLARE usuario VARCHAR(50);
  DECLARE notafinaloff,notafinalon,somanotaon float;

  select gg.id, SUM(finalgrade) AS notaFinal,SUM(grademax) as NotaMaxima from mdl_grade_grades gg
  INNER JOIN mdl_grade_items gi on gg.itemid = gi.id
  INNER JOIN mdl_course course ON gi.courseid = course.id
  INNER JOIN mdl_user user ON gg.userid = user.id
  where userid = aluno AND itemmodule like 'assign' GROUP BY itemmodule;

  select @ditCodigo=course.idnumber,@usuario=username,@courseId=course.id,SUM(finalgrade) AS notaFinal from mdl_grade_grades gg
  INNER JOIN mdl_grade_items gi on gg.itemid = gi.id
  INNER JOIN mdl_course course ON gi.courseid = course.id
  INNER JOIN mdl_user user ON gg.userid = user.id
  where userid = aluno AND itemmodule like 'quiz' GROUP BY itemmodule;

  CREATE TEMPORARY TABLE notas (dit_codigo int,login varchar(50),cur_codigo int,notaOn decimal,notaOff decimal,idNota int, notaOffMax decimal) VALUES ()
END

When executing the following error occurs when creating the temporary table:

Syntax error: missing 'semicolon'
    
asked by anonymous 29.03.2016 / 13:34

1 answer

4
CREATE TEMPORARY TABLE notas (dit_codigo int,[login] varchar(50),cur_codigo int,notaOn decimal,notaOff decimal,idNota int, notaOffMax decimal) VALUES ()
END

Login is a reserved word. Add keys to it.

    
29.03.2016 / 14:25