Oracle PL/SQL - What is the output: variable definition?

Question

What is the output of the following code?

declare 
     v_length_nr NUMBER :=5.5; 
     v_width_nr  NUMBER :=3.5; 
     v_area_nr   NUMBER; 
begin 
     v_area_nr:=v_length_nr*v_width_nr; 
     DBMS_OUTPUT.put_line('Area:'||area_nr); 
end; 
/ 


Click to view the answer

DBMS_OUTPUT.put_line('Area:'||area_nr); 
                                               * 
ERROR at line 7: 
ORA-06550: line 7, column 35: 
PLS-00201: identifier 'AREA_NR' must be declared 
ORA-06550: line 7, column 5: 
PL/SQL: Statement ignored 
SQL>

Note

In this example, the name of the variable was incorrectly typed.

As a result, the code can't be parsed.

Oracle doesn't process one line at a time.

You're sending the whole block at once, and Oracle checks the block as a whole for logical consistency.

Related Quiz