Monday, 1 October 2018

Example of FORALL Insert statement

FORALL Insert statement.

As we all know, FORALL is much faster than the FOR LOOP for processing.It is usually used for the BULK processings records.

Here is simple example of the usage of the FORALL Insert statement.

TYPE cm_per_tbl_type IS TABLE OF per_table%ROWTYPE INDEX BY PLS_INTEGER

l_per_tbl_type cm_per_tbl_type;

IF l_per_tbl_type .count > 0
THEN

          FORALL l_cnt IN l_per_tbl_type.FIRST .. l_per_tbl_type.LAST
          INSERT INTO cmx_per_table
          values  (l_per_tbl_type(l_cnt).per_id,l_per_tbl_type(l_cnt).per_name);
END IF;

The same can be modified according to the requirements and be used.







No comments:

Post a Comment