我正在尝试编写一个程序来找到一类舰艇的火力。(火力是火炮数量*排量的立方)
关系:
Classes(class, type, country, numGuns, bore, displacement)
到目前为止我尝试过的...
CREATE PRODCEDURE firePower(in className VARCHAR(50), out p int)
-> begin
-> set p = (SELECT numGuns FROM classes WHERE class = className) * (SELECT displacement
FROM classes WHERE class = className)* (SELECT displacement FROM classes WHERE class
className)
-> * (SELECT displacement FROM classes WHERE class = className)
-> )
-> 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 'PRODCEDURE
firePower(in className VARCHAR(50), out p int)
begin
set p = (SELECT ' at line 1
我知道这是一个可怕的查询。我不是在寻找性能,只是想让它正常工作。