我正在尝试编写一个程序来找到一类舰艇的火力。(火力是火炮数量*排量的立方)
关系:
Classes(class, type, country, numGuns, bore, displacement)
到目前为止我尝试过的...
mysql> CREATE PROCEDURE firePower(in className VARCHAR(50), out p int)
-> begin
-> set p = (SELECT numGuns * displacement * displacement * displacement FROM classes
WHERE class = className);
-> end
-> //
Query OK, 0 rows affected (0.35 sec)
mysql> CALL firePower(Iowa, @p)//
ERROR 1054 (42S22): Unknown column 'Iowa' in 'field list'
mysql> SELECT * FROM classes//
+----------------+------+---------+---------+------+--------------+
| class | type | country | numGuns | bore | displacement |
+----------------+------+---------+---------+------+--------------+
| Bismarck | bb | Germany | 8 | 16 | 42000 |
| Iowa | bb | USA | 9 | 16 | 46000 |
| Kongo | bc | Japan | 8 | 14 | 32000 |
| North Carolina | bb | USA | 9 | 16 | 37000 |
| Renown | bc | Britain | 6 | 15 | 32000 |
| Revenge | bb | Britain | 8 | 15 | 29000 |
| Tennessee | bb | USA | 12 | 14 | 32000 |
| Yamato | bb | Japan | 9 | 18 | 65000 |
+----------------+------+---------+---------+------+--------------+
8 rows in set (0.00 sec)
mysql> CALL firePower(Bismarck, @p)//
ERROR 1054 (42S22): Unknown column 'Bismarck' in 'field list'
mysql>
我的问题是我现在似乎无法调用我的程序......?