I'm trying to form a query that returns a list of entities within a given rectangle, using SDO_WITHIN_DISTANCE. The query I've made seems like it should work, but Oracle is giving me some strange errors. Here's the query:
SELECT *
FROM TBLENTITYLOCATION TL
INNER JOIN TBLENTITY TE
ON TE.ENTITYID=TL.ENTITYID
WHERE SDO_WITHIN_DISTANCE (TL.GEOLOCATION
, SDO_GEOMETRY (2003
, NULL
, NULL
, SDO_ELEM_INFO_ARRAY(1, 1003, 3)
, SDO_ORDINATE_ARRAY(41, -73, 36, -82)
), 'DISTANCE=10 UNIT=M'
) = 'TRUE'
AND TL.LOCATIONDATETIME= (select MAX(LOCATIONDATETIME)
FROM TBLENTITYLOCATION
WHERE ENTITYID = TE.ENTITYID)
The error is as follows:
ORA-29902: error in executing ODCIIndexStart() routine
ORA-13208: internal error while evaluating [window SRID does not match layer SRID] operator
ORA-06512: at MDSYS.SDO_INDEX_METHOD_10I", line 286
OERR says:
29902. 00000 - "error in executing ODCIIndexStart() routine"
*Cause: The execution of ODCIIndexStart routine caused an error.
*Action: Examine the error messages produced by the indextype code and take appropriate action.
Thanks for any help or ideas.