It is time-consuming to execute the data operation language (DML) in a PLSQL loop, because each loop is switched from the PLSQL engine to the SQL engine. Application FORALL is a better
It is time-consuming to execute the data operation language (DML) in the PL/SQL loop, because each loop is switched from the PL/SQL engine to the SQL engine. Application FORALL is a better
It is time-consuming to execute the data operation language (DML) in the PL/SQL loop, because each loop is switched from the PL/SQL engine to the SQL engine. Applying FORALL is a better way to submit a set of temporary values to SQL statements at a time.
Before Oracle 10 Gb, the syntax of the FORALL statement can only process continuous array elements: FORALL index_name IN lower_bound... upper_bound SQL _statement;
This means: Previously, the nested tables using FORALL cannot delete the elements in the middle of the array to be processed, and the array items must be continuously processed. Oracle 10 Gb solves these two problems and adds the indices of and values of clauses.
The indices of clause replaces lower_bound... upper_bound, indicating all valid index values to be processed, even if there is an interval between these values. It is like this:
FORALL index_name in indices of collection_name
BETWEEN lower_bound AND upper_bound
SQL _statement;
You can still apply the BETWEEN syntax to limit the scope to be processed. This is an optional content.
The values of Clause helps you process major sets in different order. Create another set that contains only the index numbers you want to process. These numbers are arranged in the order you want to process. Then the statement is changed:
FORALL index_name in values of index_collection
SQL _statement;
List A is an example of applying the HR sample model. I load the Department name to a nested table in the memory and search for IT-related departments. Each time one is found, the index of the input items in the table where I saved it. The values of clause combines this set OF indexes to perform INSERT statement processing for each department in the table. (This is just an example. You can use a separate SQL statement to perform the same processing .) List B is the output result.