Anda di halaman 1dari 1

CREATE TRIGGER cabup AFTER INSERT ON inbox FOR EACH ROW BEGIN IF SUBSTRING( new.

TextDecoded, 1, 3 ) = 'TPS' THEN INSERT INTO candidat( nope, nama, calon1, calon2, calon3 ) VALUES (SenderNumber, SPLIT_STR( new.TextDecoded, '#', '1' ), SPLIT_STR( new.TextDecoded, '#', '2' ), SPLIT_STR( new.TextDecoded, '#', '3' ), SPLIT_STR( new.TextDecoded, '#', '4' ) ); INSERT INTO outbox( DestinationNumber, Coding, TextDecoded, CreatorID ) VALUES ( new.SenderNumber, 'Default_No_Compression', CONCAT( 'Suara ', SPLIT_STR( new.TextDecoded, '#', '1' ), ' telah berhasil diinputkan ' ) , '1' ); ELSE INSERT INTO outbox( DestinationNumber, Coding, TextDecoded, CreatorID ) VALUES ( new.SenderNumber, 'Default_No_Compression', 'Maaf Format sms anda salah! ', '1' ); END IF ; END