PL/SQL: Bulk collecting and updating
BULK Collection:
- declare the table and record to hold data
TYPE r_rec is RECORD(
--table DDL);
TYPE t_table IS TABLE OF r_rec
INDEX BY binary_integer;
t_info t_table;
OPEN cursor;
FETCH cursor BULK COLLECT INTO t_info;
CLOSE cursor;
-----------------------------------------------------------------------------------------
Bulk Update:
TYPE t_num_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
t_del_info t_num_array;
FOR i IN t_info.FIRST..t_info.LAST
LOOP
t_del_info(i) := t_info(i).delivery_line_detail_id;
END LOOP;
FORALL i in 1..t_del_info.COUNT
UPDATE table
SET ----
WHERE delivery_line_detail_id = t_del_info(i);
- declare the table and record to hold data
TYPE r_rec is RECORD(
--table DDL);
TYPE t_table IS TABLE OF r_rec
INDEX BY binary_integer;
t_info t_table;
OPEN cursor;
FETCH cursor BULK COLLECT INTO t_info;
CLOSE cursor;
-----------------------------------------------------------------------------------------
Bulk Update:
TYPE t_num_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
t_del_info t_num_array;
FOR i IN t_info.FIRST..t_info.LAST
LOOP
t_del_info(i) := t_info(i).delivery_line_detail_id;
END LOOP;
FORALL i in 1..t_del_info.COUNT
UPDATE table
SET ----
WHERE delivery_line_detail_id = t_del_info(i);

0 Comments:
Post a Comment
<< Home