Še en primer prožilca

drop table if exists tup2jad;

create table tup2jad as select * from jadralec;

drop table if exists tup2log;

create table tup2log (id int primary key NOT NULL AUTO_INCREMENT, opis varchar(100), timestamp date);

DELIMITER //

create TRIGGER tup2tr after update on tup2jad

for each ROW

BEGIN

if old.ime<>new.ime THEN

     insert into tup2log (opis, timestamp) values(concat("sprememba imena iz ", old.ime, " v ", new.ime), getdate());

    END if;

END//

update tup2jad set ime="test" where jid=22;

select * from tup2log;


Last modified: Wednesday, 9 December 2020, 11:06 AM