I am trying to understand, why delimiter used with stored procedure in mysql? but i couldn\'t.
DELIMITER //
CREATE PROCEDURE GetAllProducts()
BEGIN
SEL
Mysql's default delimiter is ;
which is used for one statement in the command line , something as
select * from users ;
When you write a trigger or stored procedure to execute the entire code mysql needs to understand that its a block of code/query.
If no delimiter is provided then when mysql encounters any ;
inside the store procedure or trigger it will think that as one statement and will try to execute it. So we need to provide a delimiter for store procedure or trigger and make mysql understand that anything within that delimiter is one complete set of code.
So in your example
SELECT * FROM products;
it will be a part of the complete statement when there is a delimiter other than ;
is provided at the beginning.