Roan Khushan Chumun
Roan Khushan Chumun

Reputation: 3

Creation of stored procedure is not executing

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

Answers (2)

A Ny
A Ny

Reputation: 33

To execute the stored procedure and see the output you have to call it.

CALL sp_details()

Upvotes: 0

eshirvana
eshirvana

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

Related Questions