BEGIN DBMS_OUTPUT.put_line ('BLOCK ONE - LINE ONE'); END; / BEGIN DBMS_OUTPUT.put_line ('BLOCK TWO - LINE ONE'); DBMS_OUTPUT.disable; DBMS_OUTPUT.put_line ('BLOCK TWO - LINE THREE'); END; / BEGIN DBMS_OUTPUT.put_line ('BLOCK THREE - LINE ONE'); END; /Several players questioned our scoring of "BLOCK ONE - LINE ONE" as correct. Here are three comments that reflect the issues raised:
"I do admit that I don't use disable or enable at all, so I may be wrong in my comment here. I understood the manual that everything is flushed, even what has been run earlier. Better yet, I tested the code both in SQL Developer and Toad after answering, and in both systems, I did not get any result at all. Remarking out the disable command, I got of course all the lines. Hence, I put to you that answering that all are wrong is actually correct."
"Reading the answer, it was only then that I realised you actually meant to run block 1 first, then run block 2, then run block 3. I am so used to using TOAD, and just running several blocks one after another by using "run as script", that I assumed that was the way to do it, and that would have resulted in none of the choices being correct, as the buffer would be cleared before being displayed at all. It might be helpful to indicate in some way that these are separate statements, not to be run as a single script."
"Nothing gets displayed "after I run" three blocks in questions, first line gets displayed after first block, NOT after 3 blocks. If the intention was to take first block's output display as correct answer, then question could have been clearer by saying "What will be displayed when I run each of the following blocks in the following order?"
First, let's address the issue of order of statements and "after I run." I don't believe that I need to state in my question that the three (or N) blocks shown in the question are run "in the following order." That has always been implied in any of the questions played in the PL/SQL Challenge. Otherwise, you could argue, say, that my table has no data because the block with insert statements was run before the create table statement.
As for the IDE issue - it may well be the case that various IDEs deal with server output from DBMS_OUTPUT calls differently. And I am sorry for the confusion that this may cause. But I do not believe that I can be responsible for accounting for differences among IDE behavior or testing my quizzes across all IDEs. The quiz, so far as I know, correctly demonstrates the impact of a call to DBMS_OUTPUT.disable on the output from the current block and all subsequent blocks (until serveroutput is re-enabled, that is). It also shows (at least if you run it in SQL*Plus, which you see below) that the output of any successfully completed blocks is displayed on the screen.
SQL: BEGIN 2 DBMS_OUTPUT.put_line ('BLOCK ONE - LINE ONE'); 3 END; 4 / BLOCK ONE - LINE ONE SQL: SQL: BEGIN 2 DBMS_OUTPUT.put_line ('BLOCK TWO - LINE ONE'); 3 DBMS_OUTPUT.disable; 4 DBMS_OUTPUT.put_line ('BLOCK TWO - LINE THREE'); 5 END; 6 / SQL: SQL: BEGIN 2 DBMS_OUTPUT.put_line ('BLOCK THREE - LINE ONE'); 3 END; 4 / SQL: