DELIMITER $$
DROP PROCEDURE IF EXISTS `ipcamera`.`sp_createrec`$$
CREATE DEFINER=`vcom`@`%` PROCEDURE `sp_createrec`()
label:begin
declare _firstnum int default 0;
declare _secondnum int default 0;
declare _mac char(20);
while true do
select concat('00:00:00:00:',(lpad(hex(_secondnum),2,'0')),':',(lpad(hex(_firstnum),2,'0'))) into _mac;
set _firstnum=_firstnum+1;
if(_firstnum=256) then
set _firstnum=0;
set _secondnum=_secondnum+1;
if(_secondnum=256) then
leave label;
end if;
end if;
end while;
end$$
DELIMITER ;
|