Skip to Main Content
  • Questions
  • Create materialized view with ENABLE QUERY REWRITE for SDO_RELATE getting ORA-30373

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Ă–mer Faruk.

Asked: November 06, 2019 - 8:50 am UTC

Last updated: November 07, 2019 - 2:55 pm UTC

Version: 12.1.0

Viewed 1000+ times

You Asked

I write a query like this:

CREATE MATERIALIZED VIEW MV
REFRESH FORCE ON DEMAND

start with (sysdate) next  (sysdate+1/1440)
ENABLE QUERY REWRITE 
AS
SELECT O.ID DIREK_ID,
       MAX(LK.ADI) ISLETME_GERILIMI
  FROM  xxx O, yyy AA,
SYS_LOOKUP LK

  WHERE SDO_RELATE(O.GEOLOC, AA.GEOLOC, 'MASK=ANYINTERACT') = 'TRUE'
 AND LK.ID=AA.ISLETME_GERILIMI_ID
 GROUP BY O.ID,LK.ADI;


but this query return me this error:ORA-30373:

I WANT TO WRITE (ENABLE QUERY REWRITE ) in my query...


and Chris said...

The full text of the error says it all really:

ORA-30373: object data types are not supported in this context


Sadly Oracle Database doesn't support the use of object types in query rewrite.

As the docs say:

The defining query cannot contain any references to objects or XMLTYPEs.

https://docs.oracle.com/en/database/oracle/oracle-database/19/dwhsg/basic-materialized-views.html#GUID-580EF7BC-4C61-4030-B42D-BFF47469C1E6

So you're out of luck.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Design

New to good database design? Check out Chris Saxon's full fundamentals class.