0
我試圖通過學校列表進行循環,如果學校標識和關聯表中的context_id之間沒有交叉引用,請將其插入。循環訪問SQL數組
我recieving以下錯誤:
Erreur(141,3): PL/SQL: SQL Statement ignored
Erreur(141,24): PLS-00321: expression 'IDS' is inappropriate as the left hand side of an assignment statement
Erreur(141,28): PL/SQL: ORA-00904: : invalid identifier
Erreur(143,3): PL/SQL: Statement ignored
Erreur(143,16): PLS-00302: component 'FIRST' must be declared
(在下面的代碼塊第一行被認爲是136)
PROCEDURE APPLY_IMPLICITE(P_ID IN TBL_CONTEXTES.ID%TYPE, P_UID IN TBL_ECOLE_CONTEXTES.LAST_UID_MODIFICATION%TYPE)
IS
TYPE IDS IS TABLE OF TBL_CONTEXTES.ID%TYPE INDEX BY PLS_INTEGER;
ROW_COUNT NUMBER;
BEGIN
-- Get the IDs of all the schools
SELECT ECOLE_ID INTO IDS FROM MV_ECOLES;
-- Loop through all the schools
FOR i IN IDS.FIRST..IDS.LAST LOOP
-- Verify if a row exists
SELECT COUNT(*) INTO ROW_COUNT FROM TBL_ECOLE_CONTEXTES WHERE ECOLE_ID = IDS(i) AND ID = P_ID;
-- If no row exist, insert.
IF ROW_COUNT = 0 THEN
INSERT INTO TBL_ECOLE_CONTEXTES (ID, ECOLE_ID, LAST_UID_MODIFICATION)
VALUES (P_ID, IDS(i), P_UID);
END IF;
END LOOP;
END APPLY_IMPLICITE;