Search code examples
oracle-databasespatial-queryspatial-indexoracle-spatial

Using sdo_contains with transient object in Oracle


I have two varchar columns with wkt value (a polygon and a point). I want to know if there are a polygon that contains some point using Oracle.

I'm using sdo_contains command, but don't work. According the documentation, the polygon should be indexed. Can anyone help me how to get around this problem? I don't want to create a geometry column. I can't change the table structure or add a column.


Solution

  • SDO_CONTAINS is a spatial operator function and does indeed require an index (or rather, an indexed geometry column).

    For arbitrary in-memory geometry objects, you can use SDO_GEOM.RELATE with the CONTAINS or INSIDE mask.

    https://docs.oracle.com/cd/B19306_01/appdev.102/b14255/sdo_objgeom.htm#BGHCDIDG