I'm writing the code for an hotel management DB for school assignement. i need to insert a query inside a trigger and my sql server gives me this sintaxerror:
#1064 in the query SQL near 'SELECT codiceFiscale FROM IMPIEGATO WHERE ambiente=new.ambiente SET NEW.nome=U' line 5
CODE:
CREATE TRIGGER IF NOT EXISTS Gestione.ControlloExtra
BEFORE INSERT ON SPESEEXTRA
FOR EACH ROW
BEGIN
IF EXISTS SELECT codiceFiscale FROM IMPIEGATO WHERE ambiente=new.ambiente
SET NEW.nome=UPPER(NEW.nome);