当我像下面这样从我的包中调用我的函数时,它可以工作。它有点复杂,但有很多条件变量。
resultval := TG_PKG_ENTITY_TOTAL.user_entity_total('0012345678',
'01-JUL-1955','30-JUN-2013',amounttype,accountrec,deptrec,appealrec,
allocschoolrec,isunrestricted,pledge_exclude,pledgetypes_exclude,
honormem_exclude) ;
如果我尝试将它用作 select 语句的一部分,它就不起作用。任何想法如何解决这一问题?我认为这可能与自定义数据类型的外部引用有关。但我认为第一个例子也会失败,但它有效。
以下失败。
SELECT e.id_number,TG_PKG_ENTITY_TOTAL.user_entity_total(e.id_number,
'01-JUL-1955','30-JUN-2013',amounttype,accountrec,deptrec,appealrec,
allocschoolrec,isunrestricted,pledge_exclude,pledgetypes_exclude,
honormem_exclude) AS SoftCredit
FROM advance.entity e
*FAIL 表示它引发错误 6550 错误的参数数量或类型
以下类型在名为 TG_PKG_TYPES 的包中定义
TYPE string_array IS TABLE OF VARCHAR2(500);
TYPE account_rec IS RECORD
(condition VARCHAR2(20),
account_array string_array);
TYPE dept_rec IS RECORD
(condition VARCHAR2(20),
dept_array string_array);
TYPE allocschool_rec IS RECORD
(condition VARCHAR2(20),
school_array string_array);
TYPE appeal_rec IS RECORD
(condition VARCHAR2(20),
appeal_array string_array);
TYPE amounttype_rec IS RECORD
(GiftAmt BOOLEAN :=FALSE,
GiftCreditAmt BOOLEAN :=FALSE,
PaymentAmt BOOLEAN :=FALSE,
PayCreditAmt BOOLEAN :=FALSE,
CompanyMatch BOOLEAN :=FALSE,
EmployeeMatch BOOLEAN :=FALSE,
EmpSpouseMatch BOOLEAN :=FALSE,
EmpMatchClaim BOOLEAN :=FALSE,
EmpSpouseMatchClaim BOOLEAN :=FALSE,
PledgeAmt BOOLEAN :=FALSE,
PledgeCreditAmt BOOLEAN :=FALSE);
功能参数:
FUNCTION user_entity_total( id_number VARCHAR2 := NULL,
i_start_date VARCHAR2 :=NULL,
i_end_date VARCHAR2 :=NULL,
i_amount_type tu_pkg_types.amounttype_rec :=NULL,
i_account IN tu_pkg_types.account_rec :=NULL,
i_dept IN tu_pkg_types.dept_rec :=NULL,
i_appeal IN tu_pkg_types.appeal_rec :=NULL,
i_allocschool IN tu_pkg_types.allocschool_rec :=NULL,
i_isunrestricted CHAR :=NULL,
i_excludepledge BOOLEAN :=FALSE,
i_excludepledgetypes BOOLEAN :=FALSE,
i_excludehonormem BOOLEAN :=FALSE) RETURN NUMBER;