how to return the table type to python #252
-
So in my oracle db i have two types like this
Then I have a procedure GET_GUILD_USERS_DATA that takes an ID as IN and the variable to hold the out table type - that returns this table type once called. (it does various selects as expected in python i have something like this
is this correct? or what is the correct type for table - or for that matter is this even possible in oracledb (thin) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It would be helpful if you showed the definition of the procedure. I assume, however, that the second parameter is an OUT parameter of type GUILD_USERS_DATA_TBL. If so, something like this should get you going: typ = connection.gettype("GUILD_USERS_DATA_TBL")
user_tab = cur.var(typ)
cur.callproc("GET_GUILD_USERS_DATA", [guild_id, user_tab])
obj = user_tab.getvalue()
for user in obj.aslist():
print("my_id:", user.MY_ID) |
Beta Was this translation helpful? Give feedback.
It would be helpful if you showed the definition of the procedure. I assume, however, that the second parameter is an OUT parameter of type GUILD_USERS_DATA_TBL. If so, something like this should get you going: