mysql> source queries.txt
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'r_id INT) BEGIN SELECT temp.id,SUM(temp.hours*(e.salary/140)) AS cost FROM em' at line 1
So i am getting the above error when I compile the following script..
queries.txt
DELIMITER $$
CREATE PROCEDURE pro1(ΙΝ r_id INT)
BEGIN
SELECT temp.id,SUM(temp.hours*(e.salary/140)) AS cost
FROM employee e INNER JOIN (SELECT r.id,w.hours, w.afm FROM repair r INNER JOIN works w ON r.id=w.id WHERE r.id=r_id) AS temp
ON e.afm=temp.afm GROUP BY temp.id;
END$$
DELIMITER ;
The code between begin and end is running just fine if I replace r_id with any int, as shown below:

As you can see the only difference is at the WHERE statement, where I have placed 20013 instead
of the procedure's parameter r_id. The rest is just a copy paste. Any tips are appreciated!