postgres循环sql
CREATE OR replace function loop_addDevice(i integer) RETURNS integer as
$$
declare
count alias for $1;
all_cam int;
num_cam int;
begin<br /> all_cam :=10;<br /> while all_cam>0 Loop<br /> insert into ...<br /> all_cam:=all_cam-1;<br />
end loop;
return 0;
end;
$$
LANGUAGE plpgsql;
--连接到wsw
\c wsw
--先清空表
truncate encodedevice;
truncate element;
truncate area;
truncate camera;
select loop_addDevice(5000); 相关推荐
xgxyxs 2018-01-12