问题
I'm attempting to call AP_VENDOR_PUB_PKG.CREATE_VENDOR from cx_Oracle (This is an Oracle R12 stored procedure) It requires an argument that is a predefined PL/SQL RECORD type. (AP_VENDOR_PUB_PKG.R_VENDOR_REC_TYPE)
Here's my python code:
connection = cx_Oracle.connect(...)
cursor = connection.cursor()
obj = cursor.var(cx_Oracle.Object,
typename='AP_VENDOR_PUB_PKG.R_VENDOR_REC_TYPE')
result = cursor.callproc('AP_VENDOR_PUB_PKG.CREATE_VENDOR',
parameters=["1.0", "T", "T",
"fnd_api.g_valid_level_full", obj])
This results in the following exception:
cx_Oracle.InterfaceError: object type not associated with bind variable
What am I doing wrong? How do I call a stored procedure that requries a record type?
回答1:
I have been able to get past this problem by using
type_obj = connection.gettype('AP_VENDOR_PUB_PKG_R_VENDOR_RE')
obj = type_obj.newobject()
Note that the name is limited to 29 characters, and the period (.) has been replaced with underscore (_)
来源:https://stackoverflow.com/questions/45360966/cx-oracle-using-pl-sql-record-types-as-arguments-to-stored-procedures