[postgis-users] Execute format select into
Shaozhong SHI
shishaozhong at gmail.com
Thu Mar 26 06:51:06 PDT 2020
Dear All,
I am trying to use do loop to batch process some data. See the code below:
Do $$
DECLARE
schema_name text := 'os_postcodes';
table_name text := 'code_point_britain_point';
tbo text :='os_postcodes.code_point_britain_point';
tb text :='code_point';
overlay_polygons text := 'admin_boundaries.jsna_warwickshire_polygon';
---max = select count(*) from overlay_polygons;
Counter integer :=0;
BEGIN
For counter IN 1..3 LOOP
execute format('select a.* into %s from %s a where st_intersects(a.geom,
(select b.geom from %s b where mi_prinx = %s))=true;', tb, tbo,
overlay_polygons,counter, tb);
counter :=counter + 1;
RAISE NOTICE 'Counter: %', counter;
END LOOP;
END; $$
My question is how to loop "select into a_table from" to create a series of
new tables.
Can anyone help?
Regards,
Shao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200326/eb178ef7/attachment.html>
More information about the postgis-users
mailing list