I am trying to comment a stored procedure using MySQL workbench. I tried with the following syntax -
/**
Hai
*/
and
-- hai
These two will execute perfectly but changes never gets updated to stored procedure, while opening stored procedure it does not show any changes.
Thanks for any help.
To create line comments you just use two dashes "--" in front of the code you want to comment. You can comment out one or multiple lines with this technique. In this example the entire line is commented out.
This is a type of comment. The /* is the beginning of a comment and */ is the end of comment. MySQL will ignore the above comment.
Multi-line comments start with /* and end with */ . Any text between /* and */ will be ignored.
This worked on MySQL Workbench 8.0. 16 (Windows 10), Thank You. (Pressing Fn + Ctrl + / while a block of code is selected will comment/un-comment the block as expected.
You should place your comments inside the procedure body, i.e., what's between BEGIN
and END
. The rest of the code are instructions to create the procedure and are lost once you run them.
Comment syntax is as usual:
/* ... */
--<space>
MySQL Workbench conveniently warns about this:
MySQL has a comment feature. Official manual here.
Example:
DELIMITER $$
CREATE PROCEDURE proc_name()
COMMENT 'this is my comment'
BEGIN
/*here comes my voodoo*/
END $$
DELIMITER ;
This way you also save the comment in the database, not just in your source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With