Python sample code for PLSQL REF CURSORS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • A.M

    #1

    Python sample code for PLSQL REF CURSORS

    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.



    The technique is explained here for Java and Visual Basic:

    Use ref cursors to return recordsets (resultsets) from Oracle PL/SQL stored procedures.




    I am looking for similar code for Python



    Any help would be appreciated,

    Alan


  • Gerhard Häring

    #2
    Re: Python sample code for PLSQL REF CURSORS

    A.M wrote:[color=blue]
    > 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. [...][/color]

    import cx_Oracle

    con = cx_Oracle.conne ct("me/secret@tns")
    cur = con.cursor()
    outcur = con.cursor()
    cur.execute("""
    BEGIN
    MyPkg.MyProc(:c ur);
    END;""", cur=outcur)

    for row in out_cur:
    print row

    HTH,

    -- Gerhard

    Comment

    • A.M

      #3
      Re: Python sample code for PLSQL REF CURSORS

      Exactly what I was looking for.

      Thanks alot


      "Gerhard Häring" <gh@ghaering.de > wrote in message
      news:mailman.53 32.1146751430.2 7775.python-list@python.org ...[color=blue]
      > A.M wrote:[color=green]
      >> 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. [...][/color]
      >
      > import cx_Oracle
      >
      > con = cx_Oracle.conne ct("me/secret@tns")
      > cur = con.cursor()
      > outcur = con.cursor()
      > cur.execute("""
      > BEGIN
      > MyPkg.MyProc(:c ur);
      > END;""", cur=outcur)
      >
      > for row in out_cur:
      > print row
      >
      > HTH,
      >
      > -- Gerhard[/color]


      Comment

      Working...