views:

28

answers:

2

Hi, Please help me out to execute a MySQL Stored procedure in command line, where the procedure contains conditional statements..

+1  A: 
$ mysql --user=user_name --password=your_password db_name

mysql> call stored_procedure_name();

or

$ mysql --user=user_name --password=your_password db_name < script.sql

where script.sql contains your sql statement:

call stored_procedure_name();
dogbane
A: 

Or if you don't want to create a .sql file:

$ mysql -u your_username --password=your_password db_name <<!!
call stored_procedure_name();
!!
Andy Mc