How to create stored procedures in MySQL5
MySQL5 how to create a storage process, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.
1 Log in with mysql client
2 Select database
mysql>use test
3 Query which stored procedures exist in the current database
mysql>show procedure status where Db=test
4 Create a simple stored procedure
mysql>create procedure hi() select hello;
5 Stored procedure created, see how to call it
mysql>call hi();
mysql> call hi();
+-------+
| hello |
+-------+
| hello |
+-------+
1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec)
6 A simple stored procedure is successful, this is just a demonstration, stored procedures can execute multiple sql statements at once, so only connect once to query multiple statements; but to return multiple result sets you must use i extension to query, otherwise you will prompt an error cant return a result set in the given context, so to use these new features, it is best to adapt to the use of mysqli php extension library
Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.