cx_Oracle execute procedure

Diez B. Roggisch deets at nospam.web.de
Wed Mar 19 11:28:37 EDT 2008


Poppy wrote:

> I've been working on the code below and and executes silently, no
> complaints, however the end result should be a record in my table and it's
> not added. The procedure works with the passed credentials using SQLPlus
> or SQL Developer clients. However I'm not sure if I'm constructing my
> python code correctly to interact with Oracle.
> 
> I've been basing the code below on what I found in this thread
> http://www.thescripts.com/forum/thread33728.html .
> 
> Zach-
> 
> import cx_Oracle
> 
> connection = cx_Oracle.connect("user/pass at server")
> 
> ## PROCEDURE rptmgr.rep_utils.CLONE_REPORT( p_ordernum varchar2,p_repnum
> varchar2, p_prefix number)
> 
> cur = connection.cursor()
> 
> repParams = {}
> repParams['arg1'] = "5555555"
> repParams['arg2'] = "2"
> repParams['arg3'] = "999"
> 
> sqlStr = """BEGIN rptmgr.rep_utils.CLONE_REPORT( :arg1, :arg2, :arg3);
> end;"""
> 
> cur.execute(sqlStr, repParams)
> 
> connection.commit
> 
> cur.close
> 
> connection.close

You forgot to call the methods using the ()-operator.

connection.commit()

and so forth.

Diez



More information about the Python-list mailing list