I am trying to call a stored procedure between python and oracle db. The problem I am facing is passing the out out parameter.
Oracle stored procedure essentially:
create or replace procedure sp_procedure( cid int, rep_date date, ret out sys_refcursor ) is begin open ret for select ... end;
Calling Python code in a database:
import cx_Oracle from datetime import date connstr='user/ pass@127.0.0.1 :2521/XE' conn = cx_Oracle.connect(connstr) curs = conn.cursor() cid = 1 rep_date = date(2011,06,30) curs.callproc('sp_procedure', (cid, rep_date, curs))
Error:
curs.callproc('sp_procedure', (cid, rep_date, curs)) cx_Oracle.DatabaseError: ORA-01036: illegal variable name/number
I also tried using the dictionary as keywords. Parameters:
cid = 1 rep_date = date(2011,06,30) call_params = {'cid': cid, 'rep_date': rep_date, 'ret': curs} curs.callproc('sp_procedure', (cid, rep_date, curs), call_params)
It returns the same error.
Thanks.
source share