oracle - rails executing stored procedure error -
i have oracle stored procedure.
when try run following in sql developer works fine:
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;
but when try run above code in rails 3 follows:
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
i following error:
syntax error, unexpected tidentifier, expecting ')' cursor.bind_param(:vpan, nil, string, 1000)
any ideas?
i tried:
cursor.bind_param(:vpan, nil, varchar2, 1000);
not sure if above valid.
this line missing closing )
:
cursor.bind_param(:sperrormsg, nil, string, 1000
it should be:
cursor.bind_param(:sperrormsg, nil, string, 1000)
Comments
Post a Comment