Reputation: 3
create table SalesDetails (
DetailsId int primary key,
SaleId varchar(6),
Item varchar(10),
Quantity int
);
INSERT INTO SalesDetails VALUES('1234', 'DE230', 'Apple' , '6') ;
INSERT INTO SalesDetails VALUES('456', 'DE290', 'Pear' , '10') ;
DELIMITER //
CREATE PROCEDURE sp_details()
BEGIN
SELECT * FROM SalesDetails ;
END
DELIMITER ;
Nothing is happening when I am executing the create procedure. I am using MySQL WorkBench.
Upvotes: 0
Views: 219
Reputation: 33
To execute the stored procedure and see the output you have to call it.
CALL sp_details()
Upvotes: 0
Reputation: 24568
you need to close delimiter END //
:
create table SalesDetails (
DetailsId int primary key,
SaleId varchar(6),
Item varchar(10),
Quantity int
);
INSERT INTO SalesDetails VALUES('1234', 'DE230', 'Apple' , '6') ;
INSERT INTO SalesDetails VALUES('456', 'DE290', 'Pear' , '10') ;
DELIMITER //
CREATE PROCEDURE sp_details()
BEGIN
SELECT * FROM SalesDetails ;
END //
DELIMITER ;
Upvotes: 1