How to get output parameters from MySQL stored procedure in Rails?
I'm trying to get a output parameter from MySQL stored procedure, let's have look a example below: 1 In mysql I created this procedure and it works. CREATE PROCEDURE sp_name (out id int) Begin select id into @id from table order by id desc limit 1; End mysql> call sp_deduct_credit_and_money(@id); Query OK, 0 rows affected (0.01 sec) mysql> select @id; +--------------+ | @id | +--------------+ | 24 | +--------------+ 1 row in set (0.00 sec) 2 Therefore, it also works in Rails, BUT it won't return any value for me: ActiveRecord::Base.connection.execute("call sp_name(@id)") ActiveRecord::Base