FIZ UM EXEMPLO E FUNCIONOU 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;
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
END