mysql - Error #1109 - unknown table in field list caused by trigger -
this trigger.
i want make trigger on 1 table (pelayanan).
create definer=`root`@`localhost` trigger `before_insert_pelayanan` before insert on `pelayanan` each row if new.`estimasi` null or new.`estimasi` = 0 , `dbhpl`.`pelayanan`.`daya` <= 5500 set new.estimasi = 4; elseif new.estimasi null or new.estimasi = 0 , `dbhpl`.`pelayanan`.`daya` <= 33000 , `dbhpl`.`pelayanan`.`daya` >= 6600 set new.estimasi = 15; elseif new.estimasi null or new.estimasi = 0 , `dbhpl`.`pelayanan`.`daya` <= 197000 , `dbhpl`.`pelayanan`.`daya` >= 41500 set new.estimasi = 40; else set new.estimasi = 100; end if
when execute trigger, has been created. but, when insert data table pelayanan, become
#1109 - unknown table 'pelayanan' in field list.
how can resolve this?
i have remove dbhpl.pelayanan.daya
become pelayanan.daya
, daya
. but, doesn't work.
use new before column name. right code-
mysql> create definer=`root`@`localhost` trigger `before_insert_pelayanan` before insert on `pelayanan` each row if new.`estimasi` null or new.`estimasi` = 0 , `new`.`daya` <= 5500 set new.estimasi = 4; elseif new.estimasi null or new.estimasi = 0 , `new`.`daya` <= 33000 , `new`.`daya` >= 6600 set new.estimasi = 15; elseif new.estimasi null or new.estimasi = 0 , `new`.`daya` <= 197000 , `new`.`daya` >= 41500 set new.estimasi = 40; else set new.estimasi = 100; end if query ok, 0 rows affected (0.11 sec) mysql> insert pelayanan values (); query ok, 1 row affected (0.08 sec) mysql> select * pelayanan ; +----------+------+ | estimasi | daya | +----------+------+ | 4 | null | +----------+------+ 1 row in set (0.00 sec)
Comments
Post a Comment