BULK COLLECT INSERT and after checking duplicates <p>In plsql i want to insert around 1 million rows from a staging table to actual table and currently I am using cursor for loop for that. But I understand that there is a way to speed up this using bulk insert for all command but i am struggling in the section of eliminating duplicates. Can u please help to convert the below code to use bulk collect</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>DECLARE CURSOR c1 is select ps_item_code, item_code, cons_date, shop_code, dept_code, class_code, sub_class_code, supl_code, plu_price, sal_qty, sal_val_in_lc, disc_val_in_lc, tax_val_in_lc, odept, oclass, osubclass from sales_stage; BEGIN FOR i in c1 loop BEGIN my_cnt := 0; select count(1) into my_cnt from hps_ps_terr_sales_1415 where item_code=i.item_code and cons_date=i.cons_date and shop_code=i.shop_code and sal_qty=i.sal_qty and supl_code=i.supl_code; IF my_cnt = 0 THEN BEGIN insert into sales_actual ( ps_item_code, item_code, cons_date, shop_code, dept_code, class_code, sub_class_code, supl_code, plu_price, sal_qty, sal_val_in_lc, disc_val_in_lc, tax_val_in_lc, odept, oclass, osubclass, dept, class, subclass ) values ( i.terr_code, i.ps_item_code, i.item_code, i.cons_date, i.shop_code, i.dept_code, i.class_code, i.sub_class_code, i.supl_code, i.plu_price, i.sal_qty, i.sal_val_in_lc, i.disc_val_in_lc, i.tax_val_in_lc, i.odept, i.oclass, i.osubclass, i.dept_code, i.class_code, i.sub_class_code ); END; END IF; END; END LOOP; COMMIT; END;</code></pre> </div> </div> </p>