do $$
declare vRecord record;
declare vCurId bigint;
declare vIndex bigint;
declare vCount bigint;
begin
vIndex:=0; vCurid := 0;
loop
vIndex := 0 ;vCount := 0;
for vRecord in select objectid, (name || ',' || address || ',' || post || ',' || contacts || ',' || tel || ',' || fax || ',' || describe) as search from t_centerprises where objectid>vCurid order by objectid limit 1000 loop
vIndex := (vIndex + 1); vCurid :=vRecord.objectid; vCount := (vCount + 1);
insert into share.t_centerprises (objectid, plain) values(vRecord.objectid,vRecord.search);
if( 1000 = vCount ) then
raise notice '%', vCurid;
vCount := 0 ;
end if;
end loop;
if(0 = vIndex) then
raise notice '%', vCurid;
vCount := 0 ;
return;
end if;
end loop;
end$$;
postgresql 两个表之间快速导数据
最新推荐文章于 2024-06-27 16:58:50 发布