In Oracle, is the following Anonymous block is valid? Declare Begin End;
-
True
-
False
The anonymous PL/SQL block shown is invalid because it lacks an executable section. Even though it has the DECLARE and BEGIN/END structure, there are no statements between BEGIN and END. Oracle requires at least one executable statement (often NULL;) in the execution block. The empty execution section makes this a syntax error.
An Oracle PL/SQL anonymous block requires at least one executable statement between BEGIN and END — the executable section cannot be empty. The block shown (DECLARE BEGIN END;) has no declarations and no statements at all, which raises a compile error (PLS-00103: encountered the symbol "END"). To make it valid you'd need at minimum a NULL; statement inside BEGIN/END. Therefore the block as written is invalid, so 'False' is correct. 'True' is wrong because Oracle's parser does not accept a completely empty executable section — even a no-op block needs an explicit NULL statement.