Which statement is true about the execution of the above code?

Examine the following code:
(Exhibit)

Which statement is true about the execution of the above code?

Examine the following code:

Which statement is true about the execution of the above code?

A.
It executes and displays null.

B.
It executes and the condition returns true.

C.
It executes and control goes to the else statement.

D.
It fails because no value is assigned to the v_myage variable.



Leave a Reply 7

Your email address will not be published. Required fields are marked *


MANJUSHA

MANJUSHA

Ans :C
SQL> set serveroutput on;
SQL> declare
2 v_myage number;
3 begin
4 if v_myage

MANJUSHA

MANJUSHA

other cases:

SQL>
SQL> declare
2 v_myage varchar2;
3 begin
4 if v_myage<11 then
5 dbms_output.put_line ( 'I am a child');
6 else
7 dbms_output.put_line ( 'I am not a child');
8 end if;
9 end;
10 /

declare
v_myage varchar2;
begin
if v_myage
SQL> declare
2 v_myage varchar2(14);
3 begin
4 if v_myage
SQL> declare
2 v_myage boolean;
3 begin
4 if v_myage then
5 dbms_output.put_line ( ‘I am a child’);
6 else
7 dbms_output.put_line ( ‘I am not a child’);
8 end if;
9 end;
10 /

I am not a child

PL/SQL procedure successfully completed

SQL>
SQL> declare
2 v_myage boolean;
3 begin
4 if not v_myage then
5 dbms_output.put_line ( ‘I am a child’);
6 else
7 dbms_output.put_line ( ‘I am not a child’);
8 end if;
9 end;
10 /

I am not a child

PL/SQL procedure successfully completed

SQL>

P0

P0

Obviously C.

v_myage will be null, so program will go to else statement.