Syntax error: Variable problem inside the IF

Asked

Viewed 39 times

1

My code:

    DELIMITER //
    CREATE FUNCTION f_desc (in_preco int)
    RETURNS INT
    BEGIN
    DECLARE fim_preco INT;
    IF in_preco >= 100 THEN
        -- aqui
        fim_preco := format(10 * in_preco/100, 2);
    ELSEIF in_preco >= 200 THEN
        -- aqui
        fim_preco := format(20 * in_preco/100, 2);
    ELSE
        -- aqui
        fim_preco := in_preco;
    END IF;
    RETURN(fim_preco);
    END;
    //

Where I marked it turns red and presents:

syntax error Unexpected fim_preco

I really don’t understand why, since the variable was created..

1 answer

2


Browser other questions tagged

You are not signed in. Login or sign up in order to post.