CREATE OR replace function loop_addDevice(i integer) RETURNS integer as $$ declare count alias for $1; all_cam int; num_cam int; begin
all_cam :=10;
while all_cam>0 Loop
insert into ...
all_cam:=all_cam-1;
end loop; return 0; end; $$ LANGUAGE plpgsql; --连接到wsw c wsw --先清空表 truncate encodedevice; truncate element; truncate area; truncate camera; select loop_addDevice(5000);