I am trying to calculate taxes, however, I keep getting an error ORA-06550. Can you please aid me?
How it should to work is
- if gross pay is more than 225000 then we divide the gross pay by 3.
- if gross pay is less than 225000 then set the value at 75000
This is what I tried so far:
IF nvl(:P37_GROSS_PAY,0) > (225000*nvl:(P37_PERIOD,0)) THEN
{nvl(:P37_GROSS_PAY,0)/3}
ELSE
{75000*nvl(:P37_PERIOD,0)}
END IF;
CodePudding user response:
You have to put the result into something, such as a locally declared variable (and remove curly brackets; they are invalid in this context):
declare
tax number;
begin
if nvl(:P37_GROSS_PAY, 0) > 22500 * nvl(:P37_PERIOD, 0)) then
tax := nvl(:P37_GROSS_PAY, 0) / 3;
else
tax := 75000 * nvl(:P37_PERIOD, 0);
end if;
end;