Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

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

Posted on 2006-10-30
3
Medium Priority
?
1,795 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
Tayger earned 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

648 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