Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 330385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:40:35+00:00 2026-05-12T09:40:35+00:00

I want to create a MATERIALIZED VIEW from a LEFT JOIN of 2 tables.

  • 0

I want to create a MATERIALIZED VIEW from a LEFT JOIN of 2 tables. However the following gives me an error:

    SELECT field1 
     FROM table_1 a 
     LEFT JOIN table_2 b 
     ON a.field1=b.field2

ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view

However the following works:

SELECT field1 
 FROM table_1 a, table_2 b 
 WHERE a.field1=b.field2

Does anyone have any ideas why this is happening.

Thx for the help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:40:35+00:00Added an answer on May 12, 2026 at 9:40 am

    There are two conditions that are not satisfied to make that materialized view refresh fast. First one is that you did not specify the rowid columns of every table involved. And the second one is an undocumented restriction: ANSI-joins are not supported.

    Here is an example with DEPT being table_1, alias a and EMP being table_2, alias b:

    SQL> create materialized view log on emp with rowid
      2  /
    
    Materialized view log created.
    
    SQL> create materialized view log on dept with rowid
      2  /
    
    Materialized view log created.
    
    SQL> create materialized view empdept_mv
      2    refresh fast on commit
      3  as
      4  select a.deptno
      5    from dept a
      6         left join emp b on (a.deptno = b.deptno)
      7  /
      from dept a
           *
    ERROR at line 5:
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    

    That mimics your situation. First add the rowid’s:

    SQL> create materialized view empdept_mv
      2    refresh fast on commit
      3  as
      4  select a.rowid dept_rowid
      5       , b.rowid emp_rowid
      6       , a.deptno
      7    from dept a
      8         left join emp b on (a.deptno = b.deptno)
      9  /
      from dept a
           *
    ERROR at line 7:
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    

    Still it cannot fast refresh, because of the ANSI joins. Converting to old-style outer join syntax:

    SQL> create materialized view empdept_mv
      2    refresh fast on commit
      3  as
      4  select a.rowid dept_rowid
      5       , b.rowid emp_rowid
      6       , a.deptno
      7    from dept a
      8       , emp b
      9   where a.deptno = b.deptno (+)
     10  /
    
    Materialized view created.
    

    And to prove that it works:

    SQL> select * from empdept_mv
      2  /
    
    DEPT_ROWID         EMP_ROWID              DEPTNO
    ------------------ ------------------ ----------
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAA         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAB         30
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAC         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAD         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAE         30
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAF         30
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAG         10
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAH         20
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAI         10
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAJ         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAK         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAL         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAM         20
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAN         10
    AAARhmAAEAAAAI/AAD                            40
    
    15 rows selected.
    
    SQL> insert into dept values (50,'IT','UTRECHT')
      2  /
    
    1 row created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> select * from empdept_mv
      2  /
    
    DEPT_ROWID         EMP_ROWID              DEPTNO
    ------------------ ------------------ ----------
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAA         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAB         30
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAC         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAD         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAE         30
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAF         30
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAG         10
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAH         20
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAI         10
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAJ         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAK         20
    AAARhmAAEAAAAI/AAC AAARhlAAEAAAAI3AAL         30
    AAARhmAAEAAAAI/AAB AAARhlAAEAAAAI3AAM         20
    AAARhmAAEAAAAI/AAA AAARhlAAEAAAAI3AAN         10
    AAARhmAAEAAAAI/AAD                            40
    AAARhmAAEAAAAI7AAA                            50
    
    16 rows selected.
    

    The ANSI-join syntax restriction is mentioned in point 6 in this blogpost.

    Regards,
    Rob.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a Materialized view using the following code: CREATE MATERIALIZED VIEW M_USER_HIERARCHY BUILD
I want create simple puzzle to select random 5 names from input. Lets say
I have a Materialized view in Oracle that contains a LEFT JOIN which takes
I want to create an allocator which provides memory with the following attributes: cannot
I'm trying to create a subset of a table (as a materialized view), defined
I want create some view, and add dynamically to it text and images Somebody
I have a materialized view defined this way: CREATE MATERIALIZED VIEW M_FOO REFRESH COMPLETE
I want create a ModelForm class where model is a parameter passed from the
I want create texture atlas(matrix of images) from multiple images.Is their any applescript that
I want create Word document from another Word document, but I need replace some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.