Fala pessoal, tranquilo?
Estou com problemas em um sistema aqui, que foram cadastrados alguns dados sem determinadas informações.
Logo, pensei em criar uma procedure para completar os dados que tem informações faltando no Banco de Dados.
Este é o código:
[code]/Procedure para setar a fase dos post-its que ainda não tenham fase cadastrada/
DELIMITER $$
DROP PROCEDURE IF EXISTS ai91
.setFasePostit
$$
CREATE PROCEDURE ai91
.setFasePostit
()
BEGIN
DECLARE i_cont, cont_aux, id_atelier, id_post, id_fase, tamanhoTabela, commitator INT;
set i_cont = 1;
select max(id) into tamanhoTabela from postit;
while (i_cont <= tamanhoTabela) do
select count(*) into cont_aux from postit where fase
= “” and id
= i_cont;
IF(cont_aux > 0)
THEN
select id
into id_fase from fases where atelier
= id_atelier;
update postit set fase
= id_fase where id
= i_cont;
END IF
set i_cont = i_cont + 1;
end while;
END $$
DELIMITER ;
[/code]
Porém, o My SQL Query Browser me retorna o seguinte ERRO:
Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set i_cont = i_cont + 1;
end while;
END’ at line 15
Alguém saberia me ajudar a resolver esse probleminha?
Desde já, agradeço.