QuestionQ52

PL/SQL Language Fundamentals

Examine this statement, which executes successfully:

SQL> SET SERVEROUTPUT ON;  

Now examine the following code, which is executed:

Question Image

What is true about the result?

  • A It returns an error in line 2.
  • B It returns an error in line 4.
  • C It returns an error in line 9.
  • D It executes and displays output.
Explanation

A PL/SQL scalar variable declared with NOT NULL must be initialized in its declaration, because scalar variables otherwise default to NULL. v_deptno NUMBER(2) NOT NULL; lacks that required initialization, causing a compilation error on line 4.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!