Trigger with column check

Asked

Viewed 60 times

0

I need to make a Rigger in mysql, but I need it to be executed only when there is an update in the auctions, which change the status to 3 or 4. The way I did below is correct?

It is of the type AFTER UPDATE

BEGIN
IF (NEW.status IN ('3','4')) THEN

QUERY_AQUI

END IF;
END

2 answers

0

0

The form your code is not created trigger, to create it it is necessary to specify the CREATE TRIGGER nome_da_trigger

CREATE TRIGGER minha_trigger
AFTER UPDATE
ON minha_tabela FOR EACH ROW

BEGIN
    IF (minha_tabela.status IN ('3','4')) 
    THEN

    QUERY_AQUI

    END IF;
END;

Browser other questions tagged

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