Hi Everyone,
I have one strange problem in below small piece of code, both if and else blocks are execution at same time.
Kindly advise on this strange behavior.
DECLARE
p_year varchar2(4) := 9999;
BEGIN
FOR i IN (SELECT meaning, lookup_code FROM fnd_lookup_values
WHERE lookup_type = 'PARALLEL_ALLOCATION')
loop
DBMS_OUTPUT.PUT_LINE(i.meaning ||'-'|| i.lookup_code);
IF i.meaning = p_year THEN
DBMS_OUTPUT.PUT_LINE('Year Values now');
DBMS_OUTPUT.PUT_LINE(i.meaning ||'-'|| p_year);
else
DBMS_OUTPUT.PUT_LINE('Year Values in else');
DBMS_OUTPUT.PUT_LINE(i.meaning ||'-'|| p_year);
end if;
end loop;
END;
/
OUTPUT-
9999-2012
Year Values now
9999-9999
8888-2016
Year Values in else
8888-9999
Select used in for loop is having two values only i.e.
meaning lookup_code
9999 2012
8888 2016
Expected output should be in IF portion i.e. and else portion should not execute.
9999 and 2012 from DBMS_OUTPUT