Oracle FORALL usage (batch addition, deletion, and modification)
A key improvement of FORALL statements, which greatly simplifies code and significantly improves performance for programs that want to update many rows of data in PL/SQL
Document directory
Use bulk collect to reduce loop processing overhead
Oracle batch binding forall bulk collect
Use bulk collect to improve Oracle query efficiency
Bulk collect can be used to reduce the overhead of loop processing. Bulk collect
Let's take a look at the execution process of PLSQL blocks: When the PLSQL runtime engine processes a piece of code, it uses the PLSQL engine to execute Procedural Code and sends the SQL statement
Let's take a look at the execution process of PL/SQL
For errors in a large number of DML operations, besides using the DML error logging feature to record errors during DML, use the batch SQL statement forall saveExceptions is a good choice. The usage of the DML error logging feature is relatively
You can use the FORALL statement to Perform Batch INSERT, UPDATE, and DELETE operations in Oracle.
Syntax:
-- Syntax 1:
FORALL subscript variable (can only be referenced as subscript)INLower limit... Upper Limit
SQL statement;-- Only one SQL
How to use ForAll and bulk collect:1. Using ForAll is more efficient than for, because the former switches only once to the context, while the latter switches between multiple contexts in the same number of cycles.2. Using Bluk collect to fetch a
Simple Test of forall in PL/SQL
I wrote a bulk collect article, but I made a simple example of bulk collect.In fact, it is not only bulk collect, but forall also greatly improves pl/SQL Performance.You can see the two figures below. In pl/SQL, the
1. batch binding means that executing a single SQL operation can transmit data of all set elements, which can greatly speed up data processing and improve program performance, it is completed using the bulk collect clause and forall clause.
2.
I wrote a bulkcollect article, but I made a simple example of bulkcollect. Www.linuxidc.comLinux2015-07119948.htm in fact
I wrote a bulk collect article, but I made a simple example of bulk collect.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.