I have a query in Oracle to select polygons from my_polygon_table that interact or reside inside of a single polygon residing in border_table:

Select t1.*, t2.*, sdo_geom.sdo_intersection(t1.geoloc, t2.geom, 2 ) as genericgeo From table
 ( sdo_join ('my_border_table', 'geoloc', 'my_polygon_table', 'geom', 'mask=ANYINTERACT' ) ) j,
 my_border_table t1,my_polygon_table t2 
 (j.rowId1 = t1.rowId and j.rowId2 = t2.rowId) and (t1.geoloc.sdo_gtype = 2003 or t1.geoloc.sdo_gtype = 2007) and (t2.geom.sdo_gtype = 2003 or t2.geom.sdo_gtype = 2007) 

So far I've installed geometry with CREATE EXTENSION postgis; and copied tables. When I run a query in pgAdmin I get

ERROR:  syntax error at or near "table"
LINE 2: ...ntersection(t1.geoloc, t2.geom, 2 ) as genericgeo From table
SQL state: 42601
Character: 129

How to do the same thing with PostgreSQL?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.