I was learning sql from w3schools.Here is given simple mysql procedure but somehow I couldn’t to write down this procedure I’m new in sql please could you provide me with feedback.
x
DELIMITER //
CREATE PROCEDURE getAllAgents
BEGIN
SELECT
* FROM agents
END //
DELIMITER ;
When I try to execute this procedure I’m keep going to get following error
Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘begin select * from agents end’ at line 2
Advertisement
Answer
Try bellow
DELIMITER //
CREATE PROCEDURE SelectAllCustomers
BEGIN
SELECT * FROM Customers
END //
DELIMITER ;
call SelectAllCustomers
if you use mariyaDB
CREATE procedure selectAllCustomers()
SELECT * FROM customer
to execute
call selectAllCustomers