Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

declare
l1 number := null;
l2 number :=null;
begin
if l1=l2 then message('equal');
else
if l1<>l2 then message('not equal');
else
message('else');
end if;
end if;
end;
What will be the output ?

Answers were Sorted based on User's Feedback

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

else
bz, null is an undefined value

 Is This Answer Correct ? 8 Yes 0 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

In term of oracle block should be like as........

SQL> declare
2 l1 number := null;
3 l2 number :=null;
4 begin
5 if l1=l2 then
6 dbms_output.put_line ('equal');
7 elsif l1<>l2 then
8 dbms_output.put_line ('not equal');
9 else
10 dbms_output.put_line ('else');
11 end if;
12 end;
13 /
else

PL/SQL procedure successfully completed.

Answer is as shown at end of block ELSE.
because u can't compare a null value to other null.

 Is This Answer Correct ? 8 Yes 1 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

The message() function has not been declared in the block.
If it would have been declared then answer would be 'ELSE'

 Is This Answer Correct ? 5 Yes 0 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

Null is not a charcter,unapplicable and not space. we can't
applicable or compare to another. so the final output is "ELSE"

 Is This Answer Correct ? 3 Yes 0 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

declare
L1 number := null;
L2 number :=null;
begin
if L1=L2 then
dbms_output.put_line ('equal');
elsif L1<>L2 then
dbms_output.put_line ('not equal');
else
dbms_output.put_line ('else');
end if;
end;
/

 Is This Answer Correct ? 2 Yes 0 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

compilation error, because you should not use two times end
if;

 Is This Answer Correct ? 3 Yes 5 No

declare l1 number := null; l2 number :=null; begin if l1=l2 then message('equal&..

The answer will be "not equal"
because when two null values are compared then it Returns
False.

 Is This Answer Correct ? 1 Yes 8 No

More SQL PLSQL Interview Questions

What is Primary Key?

How much does sqlite cost?

Explain what is dbms?

what is the command used to fetch first 5 characters of the string? : Sql dba

What is tuple in sql?

Write a program that shows the usage of while loop to calculate the average of user entered numbers and entry of more numbers are stopped by entering number 0?

Are left and right joins the same?

Write a pl/sql script to display the following series of numbers: 99,96,93……9,6,3?

How do you run a query?

how can i read write files from pl/sql

What is union, minus and interact commands?

Why coalesce is used in sql?

Categories
• Oracle (3238)
• SQL Server (4518)
• MS Access (429)
• MySQL (1385)
• Postgre (483)
• Sybase (267)
• DB Architecture (141)
• DB Administration (291)
• DB Development (113)
• SQL PLSQL (3302)
• MongoDB (502)
• IBM Informix (50)
• Neo4j (82)
• InfluxDB (0)
• Apache CouchDB (44)
• Firebird (5)
• Database Management (1391)
• Databases AllOther (288)