This is not about how to write a Stored Procedure (SP), But how to efficiently write a SP.
MySQL Query Browser
The easiest way to write a SP is to use a MySQL Query Browser, Just select the database and right click the dB and "Create Stored Routite..." This shall help you do easily modify, edit and create procedures.
Unfortunately, not many of the dB guys could have access to GUI and create/edit access permissions, they may have to rely on the CLI. This is where create / edit of SPs is the most tedious. Lets set something in our system, before we log into MySQL.
- In your
~/.bashrcadd the following...
export EDITOR=vim VISUAl=vim
- Create / Edit
~/.vimrcfile, and add the following...
set noai set nonu
- Log into the MySQL CLI, and set the