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. First, create a simple table named "products" in the test database using Administrator, which includes the following two fields: www.2cto.com
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. Www.2cto.com
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 run it. The following result is obtained by rdarda.