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!

getting error-ORA-24381: error(s) in array DML

user8731258Sep 14 2010 — edited Sep 14 2010
Hi i have written the following code to bulk insert into a database table.
I am getting an error while returning the result of the bulk insert query into the collection
I have tried to track it by using sql%bulk_exceptions.error_code.
But the error code that it is showing is just 1.
I trapped it using sqlerrm.
and that is showing-error(s) in array DML

What do i do?

DECLARE
   CURSOR temp_rec_tap_cur
   IS
      SELECT *
        FROM temp_records_tap;

   TYPE temp_rec_tab IS TABLE OF temp_rec_tap_cur%ROWTYPE;
   
   v_test_tab   temp_rec_tab;
   v_rec_num    num_tab;
   v_filename   temp_records_tap.file_name%TYPE;
   v_error_code tap_reject.error_code%type;
   v_rej_value  tap_reject.field_rej%type;                       
   v_errors number;    
    
BEGIN
   
   SELECT file_name
     INTO v_filename
     FROM table1
     WHERE ROWNUM<2;

   OPEN temp_rec_tap_cur;

   LOOP
      BEGIN
         FETCH temp_rec_tap_cur
         BULK COLLECT INTO v_test_tab LIMIT 1000;

         FORALL i IN v_test_tab.FIRST .. v_test_tab.LAST SAVE EXCEPTIONS
            INSERT INTO tapdetail_tapin
                 VALUES v_test_tab (i)
              RETURNING record_num
                BULK COLLECT INTO v_rec_num;
      EXCEPTION
         WHEN DUP_VAL_ON_INDEX
         THEN
            NULL;
         WHEN OTHERS
         THEN
         v_errors:=sql%bulk_exceptions.count;
         for i in 1..v_errors
         loop
         dbms_output.put_line(sql%bulk_exceptions(i).error_code);
         p3_errorlog ('TAPINDETAWARE', SQLERRM, v_filename);      
         end loop;
         END;
            --RAISE;
      EXIT WHEN temp_rec_tap_cur%NOTFOUND;
   END LOOP;
   
INSERT INTO table2
SELECT file_id, file_name, sender_pmn, recipient_pmn, call_date,
             call_date_only, call_type, call_number, FIRST_RECORD,
             service_type, service_code, home_bid, serve_bid,
             chargeable_subs_type, imsi_min, msisdn_mdn, air_charges,
             air_charges_sdr, air_time, national_call_charges,
             national_call_charges_sdr, national_call_time,
             international_call_charges, international_call_charges_sdr,
             international_call_time, dir_assist_charges,
             dir_assist_charges_sdr, dir_assist_time, other_charges,
             other_charges_sdr, other_time, volume_charges,
             volume_charges_sdr, volume_units, tot_charges, tot_charges_sdr,
             tot_duration, state_tax, state_tax_sdr, local_tax,
             local_tax_sdr, state_and_use_tax, state_and_use_tax_sdr, va_tax,
             va_tax_sdr, other_tax, other_tax_sdr, charge_refund_indicator,
             advised_charge_currency, advised_charge, advised_charge_sdr,
             advised_charge_commission, advised_charge_commission_sdr,
             exchange_rate, mcc, mnc, process_date, chargeable_units,
             record_num, mscid,null,null,decode(call_type,0,'250',1,'251',5,'255'),null,'Duplicate Call'
             from temp_records_tap
             where record_num not in (select column_value from table(v_rec_num)) ;
   
EXCEPTION
WHEN OTHERS THEN
p3_errorlog ('TAP', SQLERRM, v_filename);   
END;
Edited by: user8731258 on Sep 14, 2010 2:58 AM

Edited by: user8731258 on Sep 14, 2010 3:01 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2010
Added on Sep 14 2010
6 comments
9,949 views