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)
Installing MySQL 5.7 from TAR.GZ on Mac OS X Comp...
SQL UNIQUE constraint The UNIQUE constraint uniqu...
Generally, on national days of mourning, days of ...
1. Download, I take 8.0 as an example Download ad...
When submitting a form, you may encounter situatio...
Table of contents Preface 1. The process of using...
1. Docker ps lists containers 2. Docker cp copies...
WebRTC, which stands for Web Real-Time Communicat...
Table of contents Preface 1. Set the prototype on...
External Access Randomly map ports Using the -P f...
Table of contents 1. Database Overview 1.1 Develo...
I'm working on electronic archives recently, ...
Table of contents About G2 Chart use Complete cod...
Vim is a text editor that we use very often in Li...
What are the lifecycle functions of React compone...