AnsweredAssumed Answered

Oracle Table Object in Python

Question asked by blake.terhune on Mar 26, 2015
Latest reply on Mar 30, 2015 by blake.terhune

I'm trying to use Python to call a procedure in another Oracle database (using cx_Oracle) that requires an input parameter of a table object. The table object needs to be comprised of some records from our Oracle SDE (a fairly simple select statement). Using Python, how do I create an Oracle table object to send it to the stored procedure?

 

Something kind of like:

oracle_sde = u'UserNameHere/PasswordHere@DatabaseNameHere'
oracle_otherdb = u'UserNameHere/PasswordHere@DatabaseNameHere'
sql = "SELECT * FROM TABLE_NAME"
sde_cnxn = cx_Oracle.connect(oracle_sde)
sde_cursor = sde_cnxn.cursor()
sde_cursor.execute(sql)
otherdb_cnxn = cx_Oracle.connect(oracle_otherdb)
otherdb_cursor = otherdb_cnxn.cursor()
otherdb_cursor.callproc("MyProcedure", sde_cursor.fetchall())

 

I know it's not really a GIS question, but I figured you guys would be up for the challenge!

Outcomes