本文介绍了调用过程时错误的数量或类型的参数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Oracle的另一个过程中调用过程?我正在尝试按以下步骤进行操作,但出现错误"PLS-00306(325:13):PLS-00306:调用的参数数目或参数类型错误TITLE_CRUD'"
How can i call procedure inside another procedure in Oracle?I'm trying as follow but i am getting that error "PLS-00306 (325: 13): PLS-00306: wrong number or types of arguments in call to 'TITLE_CRUD'"
PROCEDURE create_title(
P_TITLE varchar2,
P_USER varchar2,
P_ERR OUT VARCHAR2
)
IS
BEGIN
IF P_TITLE IS NULL THEN
P_ERR := 'Null value';
ELSE
title_crud('I',NULL,P_TITLE,P_USER);
END IF;
END;
PROCEDURE title_crud(
P_OP_TYPE VARCHAR2,
P_ID number,
P_TITLE varchar2,
P_USER varchar2,
P_ERR OUT VARCHAR2
)...
推荐答案
请参见以下更改,对title_crud
的调用没有变量来保存其返回的内容(p_err)
See the change below, the call to title_crud
doesn't have a variable to hold what is being returned by it (p_err)
PROCEDURE create_title(
P_TITLE varchar2,
P_USER varchar2,
P_ERR OUT VARCHAR2
)
IS
BEGIN
IF P_TITLE IS NULL THEN
P_ERR := 'Null value';
ELSE
title_crud('I',NULL,P_TITLE,P_USER,P_ERR); -- Extra Parameter
END IF;
END;
PROCEDURE title_crud(
P_OP_TYPE VARCHAR2,
P_ID number,
P_TITLE varchar2,
P_USER varchar2,
P_ERR OUT VARCHAR2
)...
一个容易犯的错误,但是我发现在调用一个过程时,您更容易避免使用命名符号传递参数.您对title_crud的呼叫将变为
An easy mistake to make but I find easier to avoid when calling a procedure you pass parameters by named notation. Your call to title_crud becomes
...
title_crud(P_OP_TYPE => 'I',
P_ID => NULL,
P_TITLE => P_TITLE,
P_USER => P_USER,
P_ERR => P_ERR);
...
这篇关于调用过程时错误的数量或类型的参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!