调用存储的proc,其中输入是用户定义的数据类型 - 使用python
这是Oracle PLSQL代码:
create or replace TYPE EMP_TYP IS OBJECT (
EMP_ID VARCHAR2(36), EMP_NAM VARCHAR2(50)
)
--
create or replace TYPE EMP_TAB IS TABLE OF EMP_TYP
--
create or replace PACKAGE BODY EMP_NEW_PKG
IS PROCEDURE EMP_INSERT_PROC (new_record EMP_TAB) IS
BEGIN
INSERT INTO EMPLOYEE_MAIN_TABLE ( EMP_ID, EMP_NAM )
SELECT EMP_ID, EMP_NAM FROM TABLE ( new_record ) ;
COMMIT;
END;
如何使用Python调用此存储的Proc?
我尝试了Python代码,
args = [ '12345' , 'Rajan']
cursor.callproc('EMP_NEW_PKG.EMP_INSERT_PROC', args)
Getting Error as :
PLS-00306 : wrong number or types of argument in call EMP_NEW_PKG.EMP_INSERT_PROC.
请帮助代码段 /相关参考。
This is Oracle PLSQL Code :
create or replace TYPE EMP_TYP IS OBJECT (
EMP_ID VARCHAR2(36), EMP_NAM VARCHAR2(50)
)
--
create or replace TYPE EMP_TAB IS TABLE OF EMP_TYP
--
create or replace PACKAGE BODY EMP_NEW_PKG
IS PROCEDURE EMP_INSERT_PROC (new_record EMP_TAB) IS
BEGIN
INSERT INTO EMPLOYEE_MAIN_TABLE ( EMP_ID, EMP_NAM )
SELECT EMP_ID, EMP_NAM FROM TABLE ( new_record ) ;
COMMIT;
END;
How can I call this Stored Proc using Python ?
I tried Python Code,
args = [ '12345' , 'Rajan']
cursor.callproc('EMP_NEW_PKG.EMP_INSERT_PROC', args)
Getting Error as :
PLS-00306 : wrong number or types of argument in call EMP_NEW_PKG.EMP_INSERT_PROC.
Please help with code snippet / relevent reference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须创建一个数据库对象并将其传递到存储过程。这样的东西(未经测试):
You have to create a database object and pass that through to the stored procedure. Something like this (untested):