-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Rule: use SAVE EXCEPTIONS in FORALL statement #23
Comments
from SonarSource: "FORALL" statements should use the "SAVE EXCEPTIONS" clause When the FORALL statement is used without the SAVE EXCEPTIONS clause and an exception is raised by a DML query, the whole operation is rolled back and the exception goes unhandled. Instead of relying on this default behavior, it is better to always use the SAVE EXCEPTIONS clause and explicitly handle exceptions in a ORA-24381 handler. Noncompliant Code Example
Compliant Solution
|
Using the However, using |
If I allow every step within a FORALL loop to throw an exception and therefore make this and every previous step of the loop to roll back, then I only know that this was the first step that failed. |
My point is. Do we really want to force everyone to use But if you use the |
forall is not a loop. if i want to have a all or nothing processing of all elements of the base-collection of the forall, then i see no reason for a save exception usage. |
Ok, thanks @rogertroller. Based on that I suggest to change the rule to Always process saved exceptions Saving exceptions but not processing them is similar to keeping unused variables. |
Language Usage / Exception Handling
Always use the SAVE EXCEPTIONS clause in a FORALL statement
The text was updated successfully, but these errors were encountered: