我有使用本地定义集合的代码:
CREATE OR REPLACE FUNCTION WBAR_COUNT_TEST(IB_TAKE_WAITING IN BOOLEAN DEFAULT TRUE,
IB_TAKE_ERROR IN BOOLEAN DEFAULT TRUE,
IB_TAKE_KILLED IN BOOLEAN DEFAULT TRUE,
IB_TAKE_SUCCESS IN BOOLEAN DEFAULT FALSE)
RETURN PLS_INTEGER IS
SUBTYPE ST_JOB_STATUS IS JOB_STATUS_HISTORY.STATUS%TYPE;
TYPE TTV_STATUSES IS TABLE OF ST_JOB_STATUS;
LTV_STATUSES TTV_STATUSES := TTV_STATUSES();
LN_RETURN_CODE PLS_INTEGER := 0;
PROCEDURE ADD_STATUS(IB_FLAG IN BOOLEAN,
IV_STATUS IN ST_JOB_STATUS) IS
BEGIN
IF IB_FLAG THEN
LTV_STATUSES.EXTEND;
LTV_STATUSES(LTV_STATUSES.LAST) := IV_STATUS;
END IF;
END ADD_STATUS;
BEGIN
ADD_STATUS(IB_TAKE_WAITING, 'WAITING');
ADD_STATUS(IB_TAKE_ERROR, 'ERROR');
ADD_STATUS(IB_TAKE_KILLED, 'KILLED');
ADD_STATUS(IB_TAKE_SUCCESS, 'SUCCESS');
SELECT COUNT(1)
INTO LN_RETURN_CODE
FROM JOB_STATUS_HISTORY H
WHERE H.STATUS IN (LTV_STATUSES);
RETURN LN_RETURN_CODE;
END WBAR_COUNT_TEST;
我收到:PLS-00642: local collection types not allowed in SQL statements
有什么方法可以在中定义TTV_STATUSES
为全局类型Oracle 11g R2
吗?