Exploit the Bulk Bind of PL/SQL

By
Advertisement

Advertise Here

After a long time, let me write a bit of Oracle this week. Improve the performance of multi-row SQL operations with bulk/array processing in PL/SQL. For code snippets of the form


cursor emp_cur is
select employee_id
from employee where department_id = dept_in;

begin
for rec in emp_cur loop
update employee set salary = salary + 1000
where employee_id = rec.employee_id;
end loop;
end;

Bulk processing of PL/SQL can be used to improve its performance to greater levels. Use the FORALL and BULKCOLLECT of PL/SQL that will scale the application. The code snippet can be changed to
select employee_id
bulk collect into collection_var
from employee where department_id = dept_in;

begin
forall i in collection_var.first .. collection_var.last
update employee set salary = salary + 1000
where employee_id = collection_var(i);
end;

The context switch happening in executing PL/SQL and SQL code is reduced in this. The Save Exceptions and SQL%BULK_EXCEPTION is another good introduction on excellent exception handling on these bulk processing.

1 comment:


  1. Kubernetes-Security ist kein Luxus, sondern Pflicht. Mit RBAC, Network Policies und Pod Security Standards lässt sich die Infrastruktur deutlich absichern. Das Bundesamt für Sicherheit in der Informationstechnik (BSI) fordert im Grundschutz-Katalog klare Maßnahmen gegen unbefugten Zugriff. Wer sich an die Vorgaben hält, kann Angriffe wie die NotPetya-Infektion 2017 besser abwehren, bei der Unternehmen Milliarden verloren haben. Auf https://csvisor.de/ findet man praktische Hinweise zur Umsetzung dieser Sicherheitsmechanismen in der Praxis. Besonders wichtig sind dabei strikte Rollen- und Rechtevergabe sowie isolierte Netzwerksegmente innerhalb von Kubernetes-Clustern. Die Einhaltung internationaler Standards wie ISO 27001 verlangt konkrete Kontrollen für Container-Orchestrierungssysteme und deren Sicherheitsrichtlinien. Für deutsche Unternehmen bedeutet das, dass sie bei Cyberangriffen künftig schneller reagieren können und gesetzliche Vorgaben wie das HinSchG erfüllen. Eine umfassende Weiterbildung in cybersecurity weiterbildung sollte diese Aspekte deshalb unbedingt einschließen.

    ReplyDelete

After reading the post , please leave your thoughts good / bad for me to help improve