Search code examples
mysqlstored-procedurescomments

How to comment stored procedure in MySQL


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.


Solution

  • 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:

    enter image description here