我正在尝试从2个表中的多个值并在表连接中显示它们。香港专业教育学院一直试图使用存储过程让这个工作。我的查询工作正常,因为当我测试它删除参数和插入值我得到结果。我在重新格式化查询和检查拼写之前和之后从未使用过存储过程,因此无法使其工作。
mysql> DELIMITER $$
mysql>
mysql> DROP PROCEDURE IF EXISTS `parts`.`proc_weight` $$
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> CREATE PROCEDURE `parts`.`proc_weight` (IN inputSupplier varchar(45))
->
-> BEGIN
-> SELECT parts.p_nr, project_parts_required.required_qty * parts.weight AS total_weight
-> FROM parts
-> INNER JOIN project_parts_required ON parts.p_nr = project_parts_required.part_nr
-> WHERE project_parts_required.s_nr = inputSupplier
-> END $$
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 'END'
at line 8
mysql>
mysql> DELIMITER ;