Please help me out to execute a MySQL Stored procedure in command line, where the procedure contains conditional statements..
If you have parameters,
call stored_procedure_name(intValue, doubleValue, 'dateValue');
If your stored procedure doesnot take parameters,
call stored_procedure_name();
Or:
mysql --user=your_username --execute="call stored_procedure_name()" db_name
The same as:
mysql ... -e "call stored_procedure_name()" ...
Or if you don't want to create a .sql file:
$ mysql -u your_username --password=your_password db_name <<!!
call stored_procedure_name();
!!
$ 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();