Link to home
Start Free TrialLog in
Avatar of Daman
Daman

asked on

What is the output of the sample code above, assuming SERVEROUTPUT is set ON?

my_table

Name  Null?     Type          Constraint
----  --------  ------------  -----------
ID    NOT NULL  NUMBER        PRIMARY KEY
NAME            VARCHAR2(20)

DECLARE
  ln_id   my_table.id%TYPE;

  -- Define exception for NOT NULL error.
  missing_value EXCEPTION;
  PRAGMA EXCEPTION_INIT(missing_value,-1400);
 
BEGIN
  ln_id := NULL;

  DBMS_OUTPUT.PUT_LINE(NVL(TO_CHAR(ln_id),'NULL'));

EXCEPTION

  WHEN VALUE_ERROR THEN
     DBMS_OUTPUT.PUT_LINE('Value Error');

  WHEN missing_value THEN
     DBMS_OUTPUT.PUT_LINE('Missing Value');

END;  
  What is the output of the sample code above, assuming SERVEROUTPUT is set ON?  
Choice 1  
 Value Error  
Choice 2  
 Missing Value  
Choice 3  
 0  
Choice 4  
 NULL  
Choice 5  
 The code will not compile.  
Avatar of RMZ
RMZ

[modder]
[modder]
ASKER CERTIFIED SOLUTION
Avatar of modder
modder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial