Firebase TRIGGER to Mysql

preciso converter TRIGGER do FB para Mysql

//Firebase CREATE TRIGGER RELATORIOS_BI FOR RELATORIOS ACTIVE BEFORE    INSERT POSITION 0 AS begin   if ( is null) then = gen_id(gen_relatorios_id,1); end^ 

até consegui fazer um teste com o exemplo abaixo, mas só funcionou dois registros.

//Mysql CREATE TRIGGER RELATORIOS_BI BEFORE INSERT on relatorios for each row begin   if (new.ID is null or new.ID = 0) then    set new.ID =  last_insert_id()+1;   end if;   end 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.