使用sqlplus如何执行一个包含'table of foo'参数的存储过程?
所以例如在下面的包中如何执行'Get_AnnotationsForEmp'?
create or replace PACKAGE "PKG_DROM" as
TYPE tblCostCentreIdentifier IS TABLE OF BLA_COST_CENTRE.CCE_IDENTIFIER%TYPE INDEX BY BINARY_INTEGER;
TYPE tblCCEAutoID IS TABLE OF BLA_COST_CENTRE.CCE_AUTOID%TYPE INDEX BY BINARY_INTEGER;
--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROCEDURE Get_AnnotationsForEmp(
EMP_EMPLOYEE_ID_IN IN BLA_EMPLOYEE.EMP_EMPLOYEE_ID%TYPE,
CCE_IDENTIFIER_OUT OUT tblCostCentreIdentifier,
CCE_AUTOID_OUT OUT tblCCEAutoID);
PROCEDURE Get_PastAnnotationsForEmp(
EMP_EMPLOYEE_ID_IN IN BLA_EMPLOYEE.EMP_EMPLOYEE_ID%TYPE,
CCE_IDENTIFIER_OUT OUT tblCostCentreIdentifier,
CCE_AUTOID_OUT OUT tblCCEAutoID);
END PKG_DROM;
如果程序在“BAR”包中并且看起来像这样......
PROCEDURE FOO (ID IN NUMBER);
...然后我知道我可以这样执行:
declare
r number;
begin
r := BAR.FOO (1);
end;
但是我怎样才能扩展这个想法以适应“参数”的OUT参数?
答案 0 :(得分:4)
使用package.type语法声明变量:
DECLARE
outTBL PKG_DROM.tblCostCenereIdentifier;
outAutoTBL PKG_DROM.tblCCEAutoID;
BEGIN
PKG_DROM.GET_AnnotationsForEmp(id, outTBL, outAutoTBLZ);
END;