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
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 |
Answer / sdp
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 |
Answer / subrahmanyam.k
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 |
Answer / uma
The answer will be "else"
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 |
Answer / ramesh
compilation error, because you should not use two times end
if;
Is This Answer Correct ? | 3 Yes | 5 No |
Answer / arup ratan banerjee
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 |
select 1,col1,col2 from table1. output?
How do I partition in sql?
How do I count records in sql?
ename empno deptno amar 1 10 akbar 2 20 anthonny 3 30 jonathan 4 40 write a procedure to dispaly the column values ina row separated by a deleimiter eg - input - select ename from emp '|' output - amar|akbar|anthony|jonathan input - select empno from emp '@' o/p - 1@2@3@4 input - select deptno from emp '/' o/p - 10/20/30/40 Pls answer this questn.
How do I quit sql?
what is Complex index. how to create it?
What do you think about pl/sql?
What is difference between a Cursor declared in a procedure and Cursor declared in a package specification ?
What are the 3 types of behavioral triggers?
what is sql? : Sql dba
What is trigger in sql?
explain the difference between delete , truncate and drop commands? : Sql dba