In the 19 November quiz regarding RETURN statements, many players objected to our scoring as incorrect the following statement:
"A RETURN statement can only be executed from within an execution section."
We said this is incorrect because you can also have a RETURN statement in the exception section of a block.
There were two objections to this scoring:
1. The term "execution section" is not found in the Oracle documentation. Instead, the term "executable part" is used. Thus, the question was ambiguous and should be re-scored. Here is a "typical" comment from a player on this point:
"The November 19 quiz used the phrase "execution section." A search of the 10gR2 documentation on the OTN site for that phrase does not return any hits, which indicates that "execution section" is not a defined Oracle concept. The phrase "execution section" is ambiguous since it lacks a definition that would preclude one from inferring an intent to separate code into executable (i.e., procedural) and non-executable (i.e., declarative) portions."
2. The "executable part" of a block includes the "exception handling part" of a block, since Oracle documentation states in
Understanding Block Structure:
"A PL/SQL block has three basic parts: a declarative part (
DECLARE), an executable part (
BEGIN .. END), and an exception-handling (
EXCEPTION) part that handles error conditions."
Several players concluded that since the executable part goes through the END; statement, it includes the exception section. And so this choice should have been scored as correct.
I will address these separately. First:
"Execution Section" is not a defined term
I was very surprised to see this response. Yes, these players are correct. In the documentation, the only part of the block that is required is referred to as the "executable part." It is, however, very hard for me to accept that you would not read the term "execution section" and see that it refers to the very same part of the block.
After all, if I said to you "look at the statements in the declaration section," I do not think you would say "What's that? I only know about the 'declarative part.'" (which is how Oracle, in this same part of the documentation refers to the, um, declaration section. It I talked to you about the "exception section" would you interrupt me with a correction: "Sorry, Steven, there is no such thing. There is, however, something called the 'exception-handling part.'?"
I do not believe that using the word "section" instead of "part" should cause a problem in understanding. I also do not see how using "execution" instead of "executable" would lead to confusion.
Furthermore, a quick search on the Internet for "PL/SQL execution section" shows several hits, all showing references to this "executable part" as the "execution section."
My impression is that those who objected to the term "execution section" were wrestling with the question of whether or not it is acceptable to consider the exception section to be part of the execution section. So then you looked for a definition of the term "execution section" in the Oracle documentation, could not find it, and then raised an objection about that.
Exception Section part of Execution Section?
In the
Block Declaration section of the 10g PL/SQL Users Guide and Reference, we find:
"The basic program unit in PL/SQL is the block. A PL/SQL block is defined by the keywords
DECLARE
,
BEGIN
,
EXCEPTION
, and
END
. These keywords partition the block into a declarative part, an executable part, and an exception-handling part.."
The definition of a
procedure states:
"The procedure body has three parts: an optional declarative part, an executable part, and an optional exception-handling part. The declarative part contains declarations of types, cursors, constants, variables, exceptions, and subprograms. These items are local and cease to exist when you exit the procedure. The executable part contains statements that assign values, control execution, and manipulate Oracle data. The exception-handling part contains handlers that deal with exceptions raised during execution."
In the most completely elaborated description I could find (
About Subprogram Structure of the 11g 2 day Developer's Guide), you will see the following:
The structure of a
procedure is:
PROCEDURE name [ ( parameter_list ) ]
{ IS | AS }
[ declarative_part ]
BEGIN -- executable part begins
statement; [ statement; ]...
[ EXCEPTION -- executable part ends, exception-handling part begins]
exception_handler; [ exception_handler; ]... ]
END; /* exception-handling part ends if it exists;
otherwise, executable part ends */
I suppose you could argue that it is unfair to look at 11g documentation, but this question has to do with establishing a reasonable understanding of terminology and use. It seems pretty clear to me that Oracle's intention is that the exception section (the "exception-handling part") is considered separate from the execution section (the "executable part"). Yes, some parts of the documentation mention that the execution section is between BEGIN and END, but in all the paragraphs where that appears, Oracle also clearly distinguishes between the "executable part" and the "exception-handling part."
Clearly, Oracle considers these to be distinct parts or
sections of the block.
As noted above, I also believe it is entirely reasonable to expect a PL/SQL developer to "equate" the following terms:
- "declaratitive part" and "declaration section"
- "executable part" and "execution section:
- "exception-handling part" and "exception section"
So I do not believe there is any need to re-score this quiz.
I can understand the frustration you experience with both my quizzes and Oracle documentation. I have never before realized just how "fuzzy" the "logic" is in the documentation when it comes to clearly defining terms. Partly and precisely because of that, however, we have to rely on reasonable interpretations of phrases. I believe in the case of this quiz, my terminology should be acceptable and understood clearly enough.
OK, players, time to blast away.
SF