0
How do I perform these if Else in SQL
create or replace function inss(x real)
return number is
begin 
    if x <= 840.55 then 
        return ((7.65/100) * x);
    else if (x >= 840.56) and (x <= 1050.00) then 
        return ((8.65/100) * x);
    else if (x >= 1050.01) and (x <= 1400.91) then 
        return ((9/100) * x);
    else if (x >= 1400.92) and (x <= 2801.82) then 
        return ((11/100) * x);
    else 
        return 308.20;
    end if;
end;
You’re making that mistake
Errors: FUNCTION INSS Line/Col: 15/4 PLS-00103: Encountered the Symbol ";" when expecting one of the following:
if
Place
elsifin place ofelse if– NoobSaibot
It worked, but could you teach me why if it doesn’t work? I use 10g in college and the teacher didn’t teach this way, it would be on account of upgrades?
– Enzo A.
In the construction you used you will need a
end if;for eachif, what is not necessary in constructionelseif.– anonimo
Now I understand, thank you.
– Enzo A.