Saya memiliki kode pemicu di bawah ini tetapi memberi saya kesalahan. Saya tidak tahu apa yang salah dengan kode saya.

    DROP TRIGGER IF EXISTS `user_has_voice_queues_rt_update`;
    CREATE DEFINER=`root`@`localhost` 
    TRIGGER `user_has_voice_queues_rt_update` 
    BEFORE UPDATE ON `user_has_voice_queues_rt` 
    FOR EACH ROW begin 
    if(new.pause='0') then  
    Set new.penalty = (select max(penalty) from user_has_voice_queues_rt) + 1; 
    end if;
0
Hamayun Khan 25 Maret 2019, 08:02

1 menjawab

Jawaban Terbaik

Coba ini:

DROP TRIGGER IF EXISTS `user_has_voice_queues_rt_update`;
DELIMITER $$

CREATE DEFINER=`root`@`localhost` 
TRIGGER `user_has_voice_queues_rt_update` 
BEFORE UPDATE ON `user_has_voice_queues_rt` 
FOR EACH ROW begin 
if(new.pause='0') then  
Set new.penalty = (select max(penalty) from user_has_voice_queues_rt) + 1; 
end if;

END $$
DELIMITER ;
0
Lord Elrond 26 Maret 2019, 01:35