Hi,
I am using the code below to try and insert into a table, if there is an entry in the table for this data I want to update it. I thought I was clever by trying to do the following but I am getting an error in the exception block saying that qID must be declared.
I have declared duplicate2 as the name of ORA-000001
Any ideas how I can solve this.
Thanks,
toddyl
Code:
BEGIN
FORALL qID IN arr_qROUTE_TYPE_ID.first .. arr_qROUTE_TYPE_ID.last
INSERT INTO MY_TABLE
( COLUMNS
)
VALUES
(
arr_qRTYPE_ID(qID),
arr_qPID(qID),
arr_qIC_ID(qID),
arr_qRD_ID(qID),
arr_qI_ID(qID),
arr_qS_ID(qID),
arr_qUD_TIME(qID),
);
EXCEPTION
WHEN duplicate_data THEN NULL;
WHEN duplicate2 THEN
UPDATE MY_TABLE
SET TOTAL_CSE = TOTAL_CSE + arr_q_CS(qID),
TOTAL_CSA = TOTAL_CSA + arr_q_CSA(qID),
.........
END;
END IF;
I am using the code below to try and insert into a table, if there is an entry in the table for this data I want to update it. I thought I was clever by trying to do the following but I am getting an error in the exception block saying that qID must be declared.
I have declared duplicate2 as the name of ORA-000001
Any ideas how I can solve this.
Thanks,
toddyl
Code:
BEGIN
FORALL qID IN arr_qROUTE_TYPE_ID.first .. arr_qROUTE_TYPE_ID.last
INSERT INTO MY_TABLE
( COLUMNS
)
VALUES
(
arr_qRTYPE_ID(qID),
arr_qPID(qID),
arr_qIC_ID(qID),
arr_qRD_ID(qID),
arr_qI_ID(qID),
arr_qS_ID(qID),
arr_qUD_TIME(qID),
);
EXCEPTION
WHEN duplicate_data THEN NULL;
WHEN duplicate2 THEN
UPDATE MY_TABLE
SET TOTAL_CSE = TOTAL_CSE + arr_q_CS(qID),
TOTAL_CSA = TOTAL_CSA + arr_q_CSA(qID),
.........
END;
END IF;