The following articles mainly introduce the end mark of the MySQL delimiter definition command. We all know that by default, MySQL delimiter is a semicolon ;. In the client of the command line, if a line of command ends with a semicolon, press enter and MySQL will execute this command.
Enter the following statement.
- MySQL> select * from test_table;
Press enter, and MySQL will immediately execute the statement.
But sometimes, you don't want MySQL to do this. The statement contains a semicolon.
For example, enter the stored procedure in the command line:
- MySQL> create procedure simpleproc (out paraml int)
- -> begin
- -> select count(*) into paraml from user;
- -> end
In this case, MySQL delimiter is used to change the default end mark:
- MySQL> delimiter //
- MySQL> create procedure simpleproc (out paraml int)
- -> begin
- -> select count(*) into paraml from user;
- -> end
- -> //
Then you can change it back to the original semicolon and test the stored procedure.
- MySQL> delimiter ;
- MySQL> call simpleproc(@a);
- Query OK, 0 rows affected (0.00 sec)
- MySQL> select @a;
- +------+
- | @a |
- +------+
- | 5 |
- +------+
- 1 row in set (0.00 sec)
The above content is an introduction to the end mark of the MySQL delimiter-defined command. I hope you will get something.