ciao a tutti, ho un problema con il seguente trigger per postgres
CREATE OR REPLACE FUNCTION check_conto()
RETURNS "trigger" AS
$BODY$
declare disp float;
begin
SELECT conto into disp FROM users where user_id=new.id_users;
if disp < 0.2 THEN
RAISE EXCEPTION 'no money no funny';
end if;
if disp >= 0.2
then
UPDATE users set conto = conto-0.2 where user_id=NEW.id_users;
end if;
return NEW;
end ;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
qualcuno sa indicarmi le modifiche da fare per farlo funzionare su mysql, avendo la stessa base di dati? (stesse tab e stessi attributi)