?
Solved

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

Posted on 2006-10-30
3
Medium Priority
?
1,777 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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 Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 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