postgres循环sql

Posted 大老虎打老虎

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);

 






以上是关于postgres循环sql的主要内容,如果未能解决你的问题,请参考以下文章