MYSQL5 Create a stored procedure

Source: Internet
Author: User

1 Login with MySQL client

2 Select Database

mysql>use test

3 What stored procedures are queried for 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();

Show results  mysql> call hi();
+-------+
| hello |
+-------+
| hello |
+-------+
1 row in set (0.00 sec)
  Query OK, 0 rows affected (0.01 sec)

61 Simple storage process is successful, this is just a demo, stored procedures can execute multiple SQL statements at a time, so PHP only connected to the database can query multiple statements at once, but to return multiple result sets must use MYSQLI extension to query, or will be prompted error can ' t return a Result set in the given context

So to use these new features, it's best to adapt to the PHP extension library using MYSQLI.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.