Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No Query Rewrite on Materialized View

748014Aug 4 2010 — edited Aug 4 2010
Hi everyone,

I have an odd situation where I can't enable query rewrite on any materialized view I try to create. I have all privileges granted to me. I BELIEVE I have followed all directions online that I have found regarding enabling query rewrite, so could anyone point out (I feel like it has to be obvious) why I cannot use query rewrite?
SQL> select * from v$version
  2  /

BANNER
--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

SQL> ALTER SYSTEM SET QUERY_REWRITE_ENABLED = TRUE;

System altered.

SQL> ALTER SYSTEM SET QUERY_REWRITE_INTEGRITY = STALE_TOLERATED;

System altered.

SQL> ALTER SYSTEM SET OPTIMIZER_MODE = ALL_ROWS;

System altered.

SQL> desc cef_record
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------

 ID                                        NOT NULL NUMBER(38)
 EVENT_ID                                  NOT NULL NUMBER(38)
 CEF_DATE                                           VARCHAR2(20)
 HOST_NAME                                          VARCHAR2(25)
 CEF_VERSION                                        VARCHAR2(10)
 DEVICE_VENDOR                                      VARCHAR2(75)
 DEVICE_PRODUCT                                     VARCHAR2(75)
 DEVICE_VERSION                                     VARCHAR2(75)
 SIGNATURE_ID                                       VARCHAR2(75)
 CEF_NAME                                           VARCHAR2(700)
 SEVERITY                                           VARCHAR2(25)
 CEF_DATE_VIRTUAL                                   DATE

SQL> CREATE MATERIALIZED VIEW distinct_vendors_mv
  2  BUILD IMMEDIATE
  3  REFRESH ON DEMAND
  4  ENABLE QUERY REWRITE
  5  AS
  6  SELECT distinct device_vendor FROM cef_record;
SELECT distinct device_vendor FROM cef_record
                                   *
ERROR at line 6:
ORA-30353: expression not supported for query rewrite
Thanks in advance,
Alex
This post has been answered by user503699 on Aug 4 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2010
Added on Aug 4 2010
13 comments
1,928 views