1
我遇到了SQL函數的問題,我傳遞了4個NUM_ARRAY類型的參數。我的函數掛在每個FOR循環的WHERE子句中。所以,我不確定如何將我的表格com_umn'edit_id'與我的特定參數進行比較。在SQL函數中對數組進行迭代
CREATE OR REPLACE FUNCTION DEL_BS_INFO (pLfEditDel IN NUM_ARRAY,
pRcEditDel IN NUM_ARRAY,
pSpnEditDel IN NUM_ARRAY,
pComEditDel IN NUM_ARRAY)
RETURN NUMBER
IS
tmpVar NUMBER;
--
BEGIN
-- If a deletion is checked on the Lost/Found table.
IF 0 < plfEditDel.COUNT
THEN
FOR i IN plfEditDel.FIRST .. plfEditDel.LAST
LOOP
UPDATE BSSS
SET LOST_FOUND = NULL,
LOST_DESC = NULL,
LOST_LOC = NULL,
LOST_DATE = NULL
WHERE EDIT_ID = pLfEditDel;
END LOOP;
END IF;
-- If a deletion is checked on the Returned Check table.
IF 0 < pRcEditDel.COUNT
THEN
FOR i IN pRcEditDel.FIRST .. pRcEditDel.LAST
LOOP
UPDATE XT_BSSS
SET RETURN_CHECK = NULL,
RETURN_LOC = NULL,
RETURN_DATE = NULL
WHERE EDIT_ID = pRcEditDel;
END LOOP;
END IF;
-- If a deletion is checked on the Sponsor table.
IF 0 < pSpnEditDel.COUNT
THEN
FOR i IN pSpnEditDel.FIRST .. pSpnEditDel.LAST
LOOP
UPDATE XT_BSSS
SET SPONSOR = NULL,
SPON_LOC = NULL,
SPON_START = NULL,
SPON_END = NULL
WHERE EDIT_ID = pSpnEditDel;
END LOOP;
END IF;
-- If a deletion is checked on the Comments table.
IF 0 < pComEditDel.COUNT
THEN
FOR i IN pComEditDel.FIRST .. pComEditDel.LAST
LOOP
UPDATE XT_BSSS
SET COMMENT = NULL
WHERE EDIT_ID = pComEditDel;
END LOOP;
END IF;
COMMIT;
RETURN 0;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
RETURN SQLCODE;
END XFW_DEL_BS_INFO;