wwwww
create procedure insert_capacity_disk( )
begin
declare i bigint default UNIX_TIMESTAMP(now());
declare j int default 0;
declare k int default 8;
declare totle_capacity double default 50;
declare used_capacity double default 2;
loop_label:loop
insert into tbl_capacity_disk (RESOURCE_ID,LOGICALTYPE,TOTAL_CAPACITY,USED_CAPACITY,RAIDGROUP_ID,PARENT_ID,UPDATE_TIME)
values ( 'disk00001',1,totle_capacity,used_capacity,00000001,'array0001',i);
set i=UNIX_TIMESTAMP( date_sub( now(), interval k hour)) ;
set j=j+1;
set k=k+8;
set totle_capacity=totle_capacity+50;
set used_capacity= used_capacity+15;
if j>=25 then
leave loop_label;
end if;
end loop;
end;
---------------
調用:
call insert_capacity_disk()
---------------------------------------------------------------------------------
begin
declare i bigint default UNIX_TIMESTAMP(now());
declare j int default 0;
declare k int default 8;
declare totle_capacity double default 50;
declare used_capacity double default 2;
loop_label:loop
insert into tbl_capacity_disk (RESOURCE_ID,LOGICALTYPE,TOTAL_CAPACITY,USED_CAPACITY,RAIDGROUP_ID,PARENT_ID,UPDATE_TIME)
values ( 'disk00001',1,totle_capacity,used_capacity,00000001,'array0001',i);
set i=UNIX_TIMESTAMP( date_sub( now(), interval k hour)) ;
set j=j+1;
set k=k+8;
set totle_capacity=totle_capacity+50;
set used_capacity= used_capacity+15;
if j>=25 then
leave loop_label;
end if;
end loop;
end;
---------------
調用:
call insert_capacity_disk()
---------------------------------------------------------------------------------
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.