Hi ,
Find the below two codes which are doing same logic...Consider product table has 10,000 rows..
Please advice me which one give the better performance and Why ?
Code 1
-----------------
DECLARE
TYPE prod_tab IS TABLE OF products%ROWTYPE;
products_tab prod_tab := prod_tab();
BEGIN
SELECT * BULK COLLECT INTO products_tab FROM products;
FORALL i in products_tab.first .. products_tab.last
INSERT INTO products_history VALUES products_tab(i);
COMMIT;
END;
Code2:
-------------
INSERT /*+ APPEND*/ INTO products_history (product_id,product_name)
select product_id,product_name from products;
COMMIT;