Solved

Received ORA-22818 subquery expressions not allowed here when creating materialized view

Posted on 2006-10-30
3
1,741 Views
Last Modified: 2012-06-21
Hello,

I was trying to create a materialized view to describe the referential integrity among my tables:

create materialized view user_references
   tablespace tbspc
   build immediate
   using index
   refresh complete on demand next sysdate + 1
   as
   select uic.table_name to_table, uic.column_name to_column,
      ucc.table_name from_table, ucc.column_name from_column
      from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
      where uic.index_name = uc.r_constraint_name
      and uc.constraint_name = ucc.constraint_name
      and uc.owner=upper('my_schema');

I was able to create this MV in Oracle  9.2. It failed with the following error when I ran it against Oracle 10.1:

                from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
                     *
ERROR at line 9:
ORA-22818: subquery expressions not allowed here

Is not allowing subqueries in MV a new restriction in Oracle 10? Is there a workaround?

Thanks
0
Comment
Question by:bertchan2003
3 Comments
 
LVL 2

Accepted Solution

by:
Tayger earned 50 total points
ID: 17836734
Hello

Your statement looks fine to me.

Try first to get/make sure the following grants before creating the MV:
grant query rewrite to <MV_creation_user>;
alter session set query_rewrite_enabled=true;
alter session set query_rewrite_integrity=enforced;

There is a good link about init.ora parameters for creating MVs:
http://www.akadia.com/services/ora_materialized_views.html

Hope this helps.
Tayger
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now