Home >Database >Mysql Tutorial >Create a stored procedure using MySQL Workbench?

Create a stored procedure using MySQL Workbench?

王林
王林forward
2023-08-27 14:49:011163browse

Let's first create a stored procedure. Following is the query to create a stored procedure using MySQL Workbench.

use business;
DELIMITER //
DROP PROCEDURE IF EXISTS SP_GETMESSAGE;
CREATE PROCEDURE SP_GETMESSAGE()
BEGIN
DECLARE MESSAGE VARCHAR(100);
SET MESSAGE="HELLO";
SELECT CONCAT(MESSAGE,' ','MYSQL!!!!');
END
//
DELIMITER ;

This is the screenshot of the stored procedure in MySQL workbench-

使用 MySQL Workbench 创建存储过程?

You need to execute the above stored procedure with the help of the following symbols shown in the screenshot-

使用 MySQL Workbench 创建存储过程?

Now you can execute the above statement again with the help of the symbols shown above. This will produce the following output -

使用 MySQL Workbench 创建存储过程?

The above is the detailed content of Create a stored procedure using MySQL Workbench?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete