Python Forum
Best way to return Cursor Data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to return Cursor Data
#1
I am very new to python.

--This method is encapsulated in class OracleQuery :
def executeProcedure(self, query):
try:
oracleConnectionRef = OracleConnection(self._host, self._port, self._serviceName, self._schemaUser, self._schemaPassword)
oracleConn = oracleConnectionRef.createConnection()
if oracleConn is None :
print("Connection failed to open..")
return None
else:
cur = oracleConn.cursor()
refCursorVar = cur.var(cx_Oracle.CURSOR)
cur.callproc(query, [14032, refCursorVar] )
return refCursorVar.getvalue()
except Exception as e:
print("Exception: " + str(e))

I want to write a module that will be able to run Oracle Queries( Packages, Functions, Stored Prcoedures) . What the best way to return the results of a ref Cursor. it should contain both the column definition / rows data for external clients to consume it.

Problem is if i return the cursor i am unable to iterate it because its closed.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Sqlite3 how to know when cursor.execute didn't return anything ? SpongeB0B 2 811 Dec-18-2022, 06:13 PM
Last Post: deanhystad
  Cursor Variable inside Another Cursor . CX_ORacle paulo79 1 1,480 Apr-09-2022, 10:24 AM
Last Post: ibreeden
  Return draw.rectangle pixel coordinate data to .csv file CephloRhod 0 2,360 May-20-2020, 10:37 AM
Last Post: CephloRhod

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020