MySql stored procedure-2. creation of the first MySql stored procedure-MySQL

Source: Internet
Author: User
MySql stored procedure-2. create bitsCN.com for the first MySql stored procedure
MySql stored procedure-2. create the first MySql stored procedure to see how to create a stored procedure. Although it can be created through the command line, it is basically created through the Query browser provided by MySQL. 1. create a simple table named "products" in the test database using Administrator, which includes the following two fields:
2. open Query Browser and create a stored procedure in test. the stored procedure name is "GetAll". 3. some content is added by default. Of course, you can ignore this. our stored procedure is from BEGIN to END. Click "Continue" to add the stored process to the Directory of the test database. Of course, the code provided by the system is also relatively simple. one is to redefine the delimiter of the stored procedure code as "$", because the default is "; "The semicolon is the SQL separator, so you need to redefine the separator, and then restore the separator to"; "after the storage process is completed. The next sentence defined by the delimiter is to delete a process with the same name. The process is created below.
4. write a line of select code between begin and end.
5. double-click the "GetAll" stored process in the window on the right and execute it. the following result is obtained by rdardabitsCN.com.

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.