Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

function body pl/sql, if/elseif for text field source

Ceci LovelandMar 24 2022 — edited Mar 24 2022

If I just run if and else by commenting out the middle condition, the code below works. But If I include the else if condition, it fails.
What am I doing wrong?
declare
P3_LOAN_PERIOD varchar2(11);
begin
if to_number(TO_CHAR(TO_DATE(:P3_PLP_LOAN_ENDS), 'MM')) = 12 and to_number(TO_CHAR(TO_DATE(:P3_PLP_LOAN_BEGINS), 'MM')) = 8
then P3_LOAN_PERIOD := 'FALL';
return P3_LOAN_PERIOD;
else if to_number(TO_CHAR(TO_DATE(:P3_PLP_LOAN_ENDS), 'MM')) = 5 and to_number(TO_CHAR(TO_DATE(:P3_PLP_LOAN_BEGINS), 'MM')) = 8
then P3_LOAN_PERIOD := 'FALL/SPRING';
return P3_LOAN_PERIOD;
else P3_LOAN_PERIOD := 'Other';
return P3_LOAN_PERIOD;
end if;
end;
thx for any tips!
Ceci

This post has been answered by Hamza Al-abbasi on Mar 24 2022
Jump to Answer
Comments
Post Details
Added on Mar 24 2022
4 comments
695 views