As shown below:select name from mysql.proc where db='database name'; or select routine_name from information_schema.routines where routine_schema='database name'; or show procedure status where db='database name'; SHOW CREATE PROCEDURE database.Stored procedure name; Supplement: MySQL stored procedure - loop through the query result set 1. Create a stored procedureWhen creating a stored procedure according to MySQL syntax, it is important to note that if you loop through the result set of the query, you need to take out the data in the result set for operation. CREATE DEFINER=`root`@`%` PROCEDURE `alter_view_counts`() BEGIN #Declare end flag DECLARE end_flag int DEFAULT 0; DECLARE albumId bigint; #Declare cursor album_curosr DECLARE album_curosr CURSOR FOR SELECT album_id FROM album; #Set the termination flag DECLARE CONTINUE HANDLER FOR NOT FOUND SET end_flag=1; #Open the cursor OPEN album_curosr; #Traverse the cursor REPEAT #Get the current cursor pointer record and assign the value to the custom variable FETCH album_curosr INTO albumId; #Use the obtained value to perform database operations UPDATE album SET album.views_count= (SELECT SUM(light_chat.views_count) FROM `light_chat` WHERE light_chat.album_id = albumId) WHERE album.album_id = albumId; # Determine whether to end UNTIL end_flag END REPEAT according to end_flag; #Close the cursorclose album_curosr; END 2. Calling a stored procedureCALL alter_view_counts() The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: Introduction to CSS foreground and background automatic color matching technology (demo)
>>: About the VMware vcenter unauthorized arbitrary file upload vulnerability (CVE-2021-21972)
The reason is that it was not uninstalled cleanly...
If you have installed the Win10 system and want t...
Preface: In some application scenarios, we often ...
1. Monitoring architecture diagram 2. Implementat...
Preface Since vue3.0 was officially launched, man...
1. Download the installation package -Choose the ...
1. <body background=image file name bgcolor=co...
This article shares the installation and configur...
Table of contents 1. Overview 2. Use docker to de...
Rancher deployment can have three architectures: ...
1. Basic use of firewalld start up: systemctl sta...
1. Basic usage examples of float 1. Let's fir...
transform:scale() can achieve proportional zoomin...
Table of contents 1. Why do we need vue3? 2. Adva...
1. Download address: http://dev.mysql.com/downloa...