I am trying to create a procedure to (take as arguments a new class name, type, country, number of guns, bore, and displacement. Add this information to classes and also add the ship with the class name to ships)
Relations:
classes(class, type, country, numGuns, bore, displacement)
ships(name, class, launched)
mysql> CREATE PROCEDURE addClass(in VARCHAR(50) inClassName, in VARCHAR(5) inType, in
VARCHAR(50) inCountry, in INT inNumGuns, in INT inBore, in INT inDis)
-> begin
-> INSERT INTO classes VALUES(inClassName, inType, inCountry, inNumGuns, inBore, inDis);
-> INSERT INTO ships VALUES(inClassName, inClassName, NULL);
-> 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 'VARCHAR(50)
inClassName, in VARCHAR(50) inType, in VARCHAR(50) inCountry, in INT' at line 1
I am not sure as to the source of this error, can anyone help?
The input variable names come before their data types, not after as you have specified them:
From the
CREATE PROCEDUREdocs, the spec looks like