I have created the following table:
CREATE TABLE Toy
(Toy_ID INT NOT NULL AUTO_INCREMENT,
Toy_Name VARCHAR(30) UNIQUE NOT NULL,
Toy_Price NUMERIC NOT NULL,
PRIMARY KEY (Toy_ID)
)
and then I inserted the values in toy table:
INSERT INTO Toy (Toy_Name,Toy_Price)
VALUES ('Naruto',25.00);
INSERT INTO Toy (Toy_Name,Toy_Price)
VALUES ('Goku',25.00);
INSERT INTO Toy (Toy_Name,Toy_Price)
VALUES ('Luffy',25.00);
and then I typed the following stored procedure in SQL window in phpmyadmin:
CREATE PROCEDURE searchtoy (IN toy_no INT)
BEGIN
SELECT * FROM Toy
WHERE Toy_ID = toy_no;
END;
The stored procedure has been created successfully.
Then I tried to execute the stored procedure in the SQL window and I also have added // in the Delimiter text box:
CALL searchtoy(1);
But I am getting the following error:
Error
Static analysis:
1 errors were found during analysis.
Unexpected token. (near ";" at position 17)
SQL query:
CALL searchtoy(1);
MySQL said: Documentation
#1305 - PROCEDURE demo.searchtoy does not exist
Despite the stored procedure being created successfully, it is still showing that the stored procedure does not exist.
Where did I go wrong ? It would be really helpful if the solution code is provided.