2012-10-15 48 views
0

我已經創建了下面的SP在MYSQL如何調用的Rails 3.2 OUT參數的存儲過程 - 更新

CREATE PROCEDURE usp_BookDetailsCount(OUT bookCount INT) 
BEGIN 
     SELECT count(*) INTO bookCount 

     FROM books; 

     SELECT bookCount; 
END $$ 

,我試圖用Rails 3.2.8,以獲得SP進行參數值的方式。

我在型號

count = 0 
r = ActiveRecord::Base.connection.select_value("CALL usp_BookDetailsCount(OUT count)") 
return count 

代碼,我得到了在瀏覽器

Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OUT count)' at line 1: CALL usp_BookDetailsCount(OUT count) 

以下錯誤,但我能夠得到存儲過程值,而不OUT參數在軌

回答

相關問題