Python sample code for PLSQL REF CURSORS

Gerhard Häring gh at ghaering.de
Thu May 4 10:04:56 EDT 2006


A.M wrote:
> Hi,
> 
> I am having hard time to find a sample that shows me how to return an OUT 
> REF CURSOR from my oracle stored procedure to my python program. [...]

import cx_Oracle

con = cx_Oracle.connect("me/secret at tns")
cur = con.cursor()
outcur = con.cursor()
cur.execute("""
     BEGIN
         MyPkg.MyProc(:cur);
     END;""", cur=outcur)

for row in out_cur:
     print row

HTH,

-- Gerhard



More information about the Python-list mailing list