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
    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);

猜你喜欢

转载自www.cnblogs.com/wangshaowei/p/9067214.html
今日推荐