CREATE FUNCTION public.feerange (txamount decimal,amount decimal,latefeemax decimal)
RETURNS INTEGER $feerange$
DECLARE total INTEGER;
DECLARE amountsum DECIMAL;
BEGIN
amountsum= amount + latefeemax;
if txamount <= amountsum AND txamount >= amount
THEN total=1
else
total=0
RETURN total
END;
$feerange $ LANGUAGE plpgsql;
while creating this function I'm getting an error of if condition
but I don't think there anything wrong.
the error is I'm getting is
/* ERROR: syntax error at or near "if" LINE 1: if txamount <= amountsum AND txamount >= amount
What is wrong with this? Help me to do this! Thank you !!
Aucun commentaire:
Enregistrer un commentaire