The stored procedure looks something like:
CREATE PROCEDURE `manager`(IN amount decimal(9,2), IN list text, IN acc_id int(11), OUT return_code int(1))
BEGIN
DECLARE exit handler for sqlexception, sqlwarning
BEGIN
set return_code = 1;
rollback;
END;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--my code
set return_code = 0;
END
The method from rails model is:
return_code = -1
return_code = self.connection.execute("call manager(#{amount}, '#{list}', #{acc_id}, #{return_code})")
But this throws an error:
ActiveRecord::StatementInvalid: Mysql2::Error: OUT or INOUT argument 4 for routine staging.manager is not a variable or NEW pseudo-variable in BEFORE trigger: call manager(2222, 'list', 2, -1)
Need some help on how to pass OUT parameter while calling stored procedure from rails.