Over the years, many development teams have created large scripts in anonymous blocks to run in the background and perform all sorts of complex data management tasks. Which of the choices describe a reason to move as much code as possible from the anonymous blocks into procedures and functions stored in the database (either schema-level or within packages)?
Several players raised a concern about the scoring of this choice as correct:
The business logic in the scripts is more likely to be reused.
Here is a comment that reflects the concerns:
You marked the "The business logic in the scripts is more likely to be reused." as a correct answer, but I have great doubts about its wording. From my point of few this wording should be interpreted as "business logic that stay directly in the scripts (as oppose to be moved to stored objects) has more chances to be reused". Definitely incorrect statement.
I would agree with this objection, if I had to decide on the correctness of this choice separately from the question. All by itself, "The business logic in the scripts is more likely to be reused." can be interpreted to mean either that the logic is more likely to be reused when left in the anonymous block OR when it is moved to a stored program unit.
But when playing the quiz, you do not consider these choices out of the context of the question, and the question clearly asks "Which of the choices describe a reason to move as much code as possible from the anonymous blocks into procedures and functions...?"
So I believe that the wording of the question removes any possible ambiguity - no change in scoring is required.
Another player wrote: "Can an anonymous block be optimized to the same degree as a stored procedure? The first thing that came to mind seeing that option was that an anonymous block cannot be natively compiled."
My response: I am actually not certain about what Oracle will do with anonymous scripts when native compilation is enabled, but I feel that when you are working with a language whose compiler offers automatic optimization (true of Oracle PL/SQL since 10.1), a statement like "The compiler will optimize the code in the stored program units, but it cannot do the same for an anonymous block." would most obviously and clearly relate to that optimization process and not a special feature of the Oracle Database like native compilation.
Again, no change in scoring.
Your thoughts?
SF