Migrating from Firebird to MySQL

Question:

I'm migrating a project in Firebird to MySQL, I'm having a hard time converting a procedure, I would like any tips on how to proceed, below the procedure in FIREBIRD.

CREATE PROCEDURE EXECUTA_INATIVA_TABELAS (
    OPERADOR VARCHAR(20),
    ALTERACAO TIMESTAMP)
AS
   DECLARE CGC VARCHAR(18);
   DECLARE VIGENCIA TIMESTAMP;
BEGIN
   FOR
      SELECT CGC, VIG_TAB
      FROM PARM_CALCULO
      WHERE ( VIG_TAB IS NOT NULL )
      INTO :CGC, :VIGENCIA
   DO
   BEGIN
      EXECUTE PROCEDURE INATIVA_TABELAS(:CGC, :VIGENCIA, :OPERADOR,
:ALTERACAO);
   END

   SUSPEND;
END^

Answer:

I DID AN EXAMPLE AND IT WORKED SHOW.

CREATE DEFINER=`sistema`@`localhost` PROCEDURE `ADDMESAS`()
BEGIN
declare  i integer;
delete from mesas ;
 SET i = 1;

 while  i <= 160  do
   insert into mesas (num, status) values (i, 'F');
   SET i = i + 1;
 END WHILE;

    update mesas set status = 'A'
    where num in (select codigo from r000001 );     

END
Scroll to Top