PostgreSQL使用for循环的select语句插入表

时间:2018-09-11 08:18:47

标签: sql postgresql

我有一个包含25行的场所主表。我有另一个具有1500条记录的人员表,该表属于该机构之一。我想将其他所有24个机构的相同1500条记录插入人表。

我该怎么做?

在oracle中,通过以下方式非常简单

for loop (select est_code from estableishment where est_code <> 100) 
loop 
   insert into person(...) 
   select .. from person where est_code <> 100 
end loop; 
end;

但是在Postgres中不起作用。

0 个答案:

没有答案
相关问题