码迷,mamicode.com
首页 > 数据库 > 详细

postgres循环sql

时间:2018-05-21 16:24:21      阅读:985      评论:0      收藏:0      [点我收藏+]

标签:ace   div   gre   end   loop   pre   oop   plpgsql   into   

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

标签:ace   div   gre   end   loop   pre   oop   plpgsql   into   

原文地址:https://www.cnblogs.com/wangshaowei/p/9067214.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!