赞
踩
PGsql实现循环插入查询出的数据
do $$ declare tmp record; ia int := 1; ib int := 2; ic int := 3; begin for tmp in ( select * from xxx_table xxx join position p on xxx.position_id = p.id ) loop insert into management_position_user (position_id,user_id) values (tmp.position_id, tmp.user_id); raise notice 'position_id:%, user_id:%', tmp.position_id, tmp.user_id; end loop; end; $$
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。