solution from zope-db archives was pointed to me by Maciej Wisniowski :

and here is the final implementation:

1-add a Z cxOracle Database Connection (myconnection) via pmi

2-add a python script for external method in Plone\Data\Extensions :
def mymethod(self , somename):
 conn    = self.myconnection()
 curext  = conn.db.cursor()
 curint  = conn.db.cursor()
 sql     = "begin MY_PACKAGE.MY_PROC(:p_Cursor, :p_NAME); end;"
 curext.execute(sql, (curint, somename))
 data    = TransformCursorIntoReadableText(curint)
 return data

3-add an external method :
Module name=myscript
Function Name=mymethod

This external method can be called from a "Script (python)".

banaouas a écrit :
> Hi,
> I'm starting to query an oracle 10g XE database from zope using ZSQL.
> I installed cx_Oracle-4.3.3-10g.win32-py2.4.exe and ZcxOracleDA-0.5.tar.gz.
> It works fine for simple queries.
> But how can I query a stored procedure returning a cursor ?
> In python script, this sample works fine:
>   con = cx_Oracle.connect("my_user", "my_pass", "my_server")
>   cur = con.cursor()
>   sql = "begin MY_PACKAGE.MY_PROC(:p_Cursor, :p_NAME); end;"
>   cursor.execute(sql, (cur, 'DUPONT%'))
>   ...
>   con.commit()
> thanks

Zope-DB mailing list

Reply via email to