CREATE TRIGGER "tib_pl_tookad" BEFORE INSERT
ORDER 1 ON "DBA"."pl_tookad"
referencing new as new_name
for each row
begin
  declare id1 integer;
  if(new_name.tookid is null) or(new_name.tookid = 0) then
    select getid_pl_tookad() into id1 from DUMMY;
    set new_name.tookid=id1
  end if;
  set new_name.kell=Now(*);
  set new_name.kell2=Now(*);
end