Helldron
16-12-2010, 16:46
Ciao ragazzi,
mi serve un aiuto per capire dove sbaglio nella sintassi di questo trigger SQL:
"data_nascita" e "anno_assunzione" sono colonne della tabella Dipendenti
mysql> CREATE TRIGGER ctrl_data
-> BEFORE INSERT ON Personale
-> FOR EACH ROW
-> BEGIN
-> IF
-> NEW.data_nascita>'1991-12-31' AND NEW.anno_assunzione<2009 THEN
-> SET NEW.data_nascita=0000-00-00
-> SET NEW.anno_assunzione=0000
-> END IF
-> END
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET NEW.anno_assunzione=0000
END IF
END' at line 8
In pratica manca qualcosa alla linea 8, ma cosa??
Grazie :D
mi serve un aiuto per capire dove sbaglio nella sintassi di questo trigger SQL:
"data_nascita" e "anno_assunzione" sono colonne della tabella Dipendenti
mysql> CREATE TRIGGER ctrl_data
-> BEFORE INSERT ON Personale
-> FOR EACH ROW
-> BEGIN
-> IF
-> NEW.data_nascita>'1991-12-31' AND NEW.anno_assunzione<2009 THEN
-> SET NEW.data_nascita=0000-00-00
-> SET NEW.anno_assunzione=0000
-> END IF
-> END
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET NEW.anno_assunzione=0000
END IF
END' at line 8
In pratica manca qualcosa alla linea 8, ma cosa??
Grazie :D