All Things Techie With Huge, Unstructured, Intuitive Leaps
Showing posts with label stored procedures. Show all posts
Showing posts with label stored procedures. Show all posts

Calling A MySQL Stored Procedure From The Command Line With Output Parameters



I had a junior programmer ask me how to do stored procedure calls from the MySQL command line that had output parameters.  It had stumped him, and he had no other choice but to use the command line instead of a GUI tool, because he was working remotely on a Linux server.

Here is how to do it.  Suppose that the stored procedure has two input parameters and two output parameters.  Here is the syntax:


call doStoredProcedure('param1', 'param2', @t, @s);
select @t, @s;

The second line retrieves the output of the stored procedure.

Hope this helps someone.

Using mysqldump To Back Up Routines, Stored Procedures, Triggers, Functions etc



I had to answer this question again, so I will post it here.  If you want mysqldump to save routines, stored procedures, triggers and functions, here is the command:

mysqldump -uroot -p<password> --routines <name_of_database> > c:\<filename>.sql