Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

unkown error message repeation error ..

685758Jan 28 2011 — edited Jan 28 2011
hi all,
I m getting repeating error message(any type of error message) for "insert block 1" "& insert bolock 2".
Is this due to "limit" option as i am using 2 and total data in cursor is 4 records(let say).

kindly help me...
------------------------------------------------------------------------------------------------------------------------


DECLARE
CURSOR CUR_C_N_HEAD IS
SELECT DCNH_C_N_Number
,TO_DATE(DCNH.C_N_DATE) + 180
,ROUND(NVL(DCNH.C_N_AMT,0) - NVL(DCNH.C_N_E_AMT,0),2)
,CASE WHEN DCNH.C_N_STAT ='TRUE' THEN 'REDEEM' ELSE 'ISSUED' END
,'fakeFirst'
,'fakeLast'
, 'fakeTYPE'
,'0'
,null null1
,null null2
FROM DBMG_C_N_HEAD DCNH
WHERE RESET_STS ='NON RESET'
and rownum<5
;

TYPE fetch_array IS TABLE OF CUR_C_N_HEAD%ROWTYPE ;
CNH_ARRAY fetch_array;

Do_Cr_Str_Cnt NUMBER := 0 ;
Do_Cr_Str_Err_Cnt NUMBER := 0 ;
Do_Cr_Str_Cnt2 NUMBER := 0 ;
Do_Cr_Str_Err_Cnt2 NUMBER := 0 ;
Cur_DTime DATE;
EXCP EXCEPTION;



BEGIN
--execute immediate 'truncate table Do_Cr_Str_Pc1 Do_Cr_Str_Pc2';
--execute immediate 'truncate table Do_Cr_Str_Pc1 Do_Cr_Str_Pc2';

DBMS_OUTPUT.PUT_LINE( chr(10)||'*Start time:Loading from C_N_HEAD to DO_CR_STR:'||systimestamp );

BEGIN
OPEN CUR_C_N_HEAD;
LOOP

FETCH CUR_C_N_HEAD BULK COLLECT INTO CNH_ARRAY LIMIT 2;

begin
FORALL i IN 1..CNH_ARRAY.COUNT SAVE EXCEPTIONS
INSERT INTO Do_Cr_Str_Pc1
VALUES CNH_ARRAY(i);

Do_Cr_Str_Cnt := Do_Cr_Str_Cnt + CNH_ARRAY.COUNT ;
EXCEPTION
WHEN OTHERS THEN
Do_Cr_Str_Err_Cnt := SQL%BULK_EXCEPTIONS.COUNT ;
DBMS_OUTPUT.PUT_LINE('#Unexpected Error:Loading from C_N_HEAD to DO_CR_STR1:Total Error:'||Do_Cr_Str_Err_Cnt||' :'||CHR(10)||SqleRrm);
FOR i in 1.. SQL%BULK_EXCEPTIONS.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE ('Record '||SQL%BULK_EXCEPTIONS(i).error_index||':Error:'||SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
end;


begin
FORALL i IN 1..CNH_ARRAY.COUNT SAVE EXCEPTIONS
INSERT INTO Do_Cr_Str_Pc2
VALUES CNH_ARRAY(i);

Do_Cr_Str_Cnt2 := Do_Cr_Str_Cnt2 + CNH_ARRAY.COUNT ;

EXCEPTION
WHEN OTHERS THEN
Do_Cr_Str_Err_Cnt2 := SQL%BULK_EXCEPTIONS.COUNT ;
DBMS_OUTPUT.PUT_LINE('#Unexpected Error:Loading from C_N_HEAD to Do_Cr_Str_Pc2:Total Error:'||Do_Cr_Str_Err_Cnt2||' :'||CHR(10)||SqleRrm);
FOR i in 1.. SQL%BULK_EXCEPTIONS.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE ('Record '||SQL%BULK_EXCEPTIONS(i).error_index||':Error:'||SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP;
end;



EXIT WHEN CUR_C_N_HEAD%NOTFOUND;
END LOOP;
CLOSE CUR_C_N_HEAD;

COMMIT;



END;

DBMS_OUTPUT.PUT_LINE(' Successfully loaded count in DO_CR_STR1 : '||NVL(Do_Cr_Str_Cnt ,0));
DBMS_OUTPUT.PUT_LINE(' Total error count in DO_CR_STR1 : '||NVL(Do_Cr_Str_Err_Cnt,0));

DBMS_OUTPUT.PUT_LINE(' Successfully loaded count in DO_CR_STR2 : '||NVL(Do_Cr_Str_Cnt2 ,0));
DBMS_OUTPUT.PUT_LINE(' Total error count in DO_CR_STR2 : '||NVL(Do_Cr_Str_Err_Cnt2,0));

DBMS_OUTPUT.PUT_LINE('*End time:Loading end from C_N_HEAD to DO_CR_STR : '||systimestamp );
DBMS_OUTPUT.PUT_LINE(chr(10)||'**Total Time Consumed C_N_HEAD to DO_CR_STR: '||(systimestamp - Cur_DTime)||chr(10) );
DBMS_OUTPUT.PUT_LINE(rpad('-',90,'-') );

/* EXCEPTION
WHEN OTHERS THEN
Do_Cr_Str_Err_Cnt := SQL%BULK_EXCEPTIONS.COUNT ;
DBMS_OUTPUT.PUT_LINE('#Unexpected Error:Loading from C_N_HEAD to DO_CR_STR1:Total Error:'||Do_Cr_Str_Err_Cnt||' :'||CHR(10)||SqleRrm);
FOR i in 1.. SQL%BULK_EXCEPTIONS.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE ('Record '||SQL%BULK_EXCEPTIONS(i).error_index||':Error:'||SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
END LOOP; */

END;
------------------------------------------------------------------------------------------------------------------------
o/p is:-

*Start time:Loading from C_N_HEAD to DO_CR_STR:28-JAN-11 01.51.34.259000000 PM +05:30

#Unexpected Error:Loading from C_N_HEAD to DO_CR_STR1:Total Error:2 :
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated

#Unexpected Error:Loading from C_N_HEAD to Do_Cr_Str_Pc2:Total Error:2 :
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated

#Unexpected Error:Loading from C_N_HEAD to DO_CR_STR1:Total Error:2 : -- note this is repeating
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated

#Unexpected Error:Loading from C_N_HEAD to Do_Cr_Str_Pc2:Total Error:2 : -- note this is repeating
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated

Successfully loaded count in DO_CR_STR1 : 0
Total error count in DO_CR_STR1 : 2
Successfully loaded count in DO_CR_STR2 : 0
Total error count in DO_CR_STR2 : 2
*End time:Loading end from C_N_HEAD to DO_CR_STR : 28-JAN-11 01.51.34.946000000 PM +05:30

**Total Time Consumed C_N_HEAD to DO_CR_STR:

------------------------------------------------------------------------------------------


and if i incresing LIMIT as max value of cursor records limit=4 then o/p is correct.
kindly help me to fix
o/p with limit=4

*Start time:Loading from C_N_HEAD to DO_CR_STR:28-JAN-11 01.55.24.502000000 PM +05:30

#Unexpected Error:Loading from C_N_HEAD to DO_CR_STR1:Total Error:4 :
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated
Record 3:Error:ORA-00001: unique constraint (.) violated
Record 4:Error:ORA-00001: unique constraint (.) violated

#Unexpected Error:Loading from C_N_HEAD to Do_Cr_Str_Pc2:Total Error:4 :
ORA-24381: error(s) in array DML
Record 1:Error:ORA-00001: unique constraint (.) violated
Record 2:Error:ORA-00001: unique constraint (.) violated
Record 3:Error:ORA-00001: unique constraint (.) violated
Record 4:Error:ORA-00001: unique constraint (.) violated

Successfully loaded count in DO_CR_STR1 : 0
Total error count in DO_CR_STR1 : 4
Successfully loaded count in DO_CR_STR2 : 0
Total error count in DO_CR_STR2 : 4
*End time:Loading end from C_N_HEAD to DO_CR_STR : 28-JAN-11 01.55.24.548000000 PM +05:30

**Total Time Consumed C_N_HEAD to DO_CR_STR:

------------------------------------------------------------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2011
Added on Jan 28 2011
5 comments
132 views