rails执行存储过程错误

rails executing stored procedure error

我有一个oracle存储过程。

当我在 sql 开发人员中尝试 运行 以下内容时,它工作正常:

declare
   vPan varchar2(32);
   ErrorMsg varchar2(32);
   ErrorCode varchar2(32);
   SpErrorMsg varchar2(32);

begin


  DBO_MYDB.PKG_LTD.GET_PAN('8042049440330819','32', 'TEST', '0',vPan, ErrorMsg, ErrorCode, SpErrorMsg);
  DBMS_OUTPUT.PUT_LINE(vPan);

end;

但是当我尝试运行上面的代码时rails3如下:

def number
    errormsg = nil
    errorcode = nil
    sperrormsg = nil
    vpan = nil

    sql =
  "BEGIN #{Pkgltd::PKG_LTD}.GET_PAN('
    8042049440330819','32', 'TEST', '0',vpan, errormsg, errorcode, sperrormsg);
   END;"

   connection = self.connection.raw_connection
   cursor = connection.parse(sql)

     cursor.bind_param(:errormsg, nil, String, 1000)
     cursor.bind_param(:errorcode, nil, String, 1000)
     cursor.bind_param(:sperrormsg, nil, String, 1000
         cursor.bind_param(:vpan, nil, String, 1000)

   cursor.exec

   vpan, errormsg, errorcode, sperrormsg, vpan = cursor[:vpan], cursor[:errormsg], cursor[:errorcode], cursor[:sperrormsg]
   cursor.close
   vpan
end

我收到以下错误:

syntax error, unexpected tIDENTIFIER, expecting ')' cursor.bind_param(:vpan, nil, String, 1000)

有什么想法吗?

我什至尝试过:

cursor.bind_param(:vpan, nil, varchar2, 1000);

不确定以上是否有效。

此行缺少结尾 ):

cursor.bind_param(:sperrormsg, nil, String, 1000

应该是:

cursor.bind_param(:sperrormsg, nil, String, 1000)