Any way to materialize with fast refresh this query?

I have three tables, A, B, C
my query is:
select
from
A
inner join B on B.col=A.col
left join C on C.b_id=B.id and C.a_id=A.id
in essence, C is overriding a value from B in case it exists. I use this join often so I'd like to materialize it for performance reasons. The problem is, Mview requires traditional syntax (why is that??) which does not support joining C on two tables. Any way around this?
Thanks

Jernej Kase wrote:
The problem is, Mview requires traditional syntax (why is that??) which does not support joining C on two tables. Any way around this?Hi Jernej,
Your analysis is right. I don't know why MV's don't support ANSI join syntax, but I have encountered it before. Probably because when MV's where introduced, the ANSI join didn't exist in Oracle yet. But there is a way around this.
First, reproducing your situation:
SQL> create table a(id,col)
  2  as
  3  select 1, 'name 1' from dual union all
  4  select 2, 'name 2' from dual union all
  5  select 3, 'name 3' from dual
  6  /
Tabel is aangemaakt.
SQL> create table b (id,col)
  2  as
  3  select 1, 'name 1' from dual union all
  4  select 2, 'name 2' from dual union all
  5  select 3, 'name 3' from dual
  6  /
Tabel is aangemaakt.
SQL> create table c (a_id,b_id,col)
  2  as
  3  select 2, 2, 'name c2' from dual union all
  4  select 3, 3, 'name c3' from dual union all
  5  select 4, 4, 'name c4' from dual
  6  /
Tabel is aangemaakt.
SQL> alter table a add primary key (id)
  2  /
Tabel is gewijzigd.
SQL> alter table b add primary key (id)
  2  /
Tabel is gewijzigd.
SQL> alter table c add primary key (a_id,b_id)
  2  /
Tabel is gewijzigd.
SQL> select
  2  *
  3  from
  4  A
  5  inner join B on B.col=A.col
  6  left join C on C.b_id=B.id and C.a_id=A.id
  7  /
   ID COL       ID COL     A_ID  B_ID COL
    1 name 1     1 name 1
    2 name 2     2 name 2     2     2 name c2
    3 name 3     3 name 3     3     3 name c3
3 rijen zijn geselecteerd.
SQL> create materialized view log on a with rowid
  2  /
Gematerialiseerde viewlog is aangemaakt.
SQL> create materialized view log on b with rowid
  2  /
Gematerialiseerde viewlog is aangemaakt.
SQL> create materialized view log on c with rowid
  2  /
Gematerialiseerde viewlog is aangemaakt.
SQL> create materialized view abc_mv
  2    refresh fast on commit
  3  as
  4  select a.rowid a_rowid
  5       , b.rowid b_rowid
  6       , c.rowid c_rowid
  7       , a.id    a_id
  8       , b.id    b_id
  9       , a.col   a_col
10       , b.col   b_col
11       , c.col   c_col
12    from A
13         inner join B on B.col=A.col
14         left join C on C.b_id=B.id and C.a_id=A.id
15  /
       left join C on C.b_id=B.id and C.a_id=A.id
FOUT in regel 14:
.ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized viewTo circumvent this error message, the only option I see is to use nested MV's like this:
SQL> create materialized view ab_mv
  2    refresh fast on commit
  3  as
  4  select a.rowid a_rowid
  5       , b.rowid b_rowid
  6       , a.id    a_id
  7       , b.id    b_id
  8       , a.col   a_col
  9       , b.col   b_col
10    from a
11       , b
12   where a.col = b.col
13  /
Gematerialiseerde view is aangemaakt.
SQL> create materialized view log on ab_mv with rowid
  2  /
Gematerialiseerde viewlog is aangemaakt.
SQL> create materialized view abc_mv
  2    refresh fast on commit
  3  as
  4  select ab.rowid ab_rowid
  5       , c.rowid  c_rowid
  6       , ab.a_id  a_id
  7       , ab.b_id  b_id
  8       , ab.a_col a_col
  9       , ab.b_col b_col
10       , c.col    c_col
11    from ab_mv ab
12       , c
13   where ab.a_id = c.a_id (+)
14     and ab.b_id = c.b_id (+)
15  /
Gematerialiseerde view is aangemaakt.And to show that this works:
SQL> select * from abc_mv
  2  /
AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
AAGpZ4AAQAAAS2sAAA                        1     1 name 1 name 1
AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c2
AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
3 rijen zijn geselecteerd.
SQL> update c set col = 'name c9' where a_id = 2
  2  /
1 rij is bijgewerkt.
SQL> commit
  2  /
Commit is voltooid.
SQL> select * from abc_mv
  2  /
AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
AAGpZ4AAQAAAS2sAAA                        1     1 name 1 name 1
AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c9
AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
3 rijen zijn geselecteerd.
SQL> insert into c values (1, 1, 'bla')
  2  /
1 rij is aangemaakt.
SQL> commit
  2  /
Commit is voltooid.
SQL> select * from abc_mv
  2  /
AB_ROWID           C_ROWID             A_ID  B_ID A_COL  B_COL  C_COL
AAGpZ4AAQAAAS2sAAA AAGpZxAAQAAAMrVAAA     1     1 name 1 name 1 bla
AAGpZ4AAQAAAS2sAAB AAGpZxAAQAAAMrUAAA     2     2 name 2 name 2 name c9
AAGpZ4AAQAAAS2sAAC AAGpZxAAQAAAMrUAAB     3     3 name 3 name 3 name c3
3 rijen zijn geselecteerd.Regards,
Rob.

Similar Messages

  • How do I get a refund?  I have tried to use this converter to change a PDF to a word document or excel document three of four times and it always fails..  I want my money back but don't see any way to communicate with Adobe.

    How do I get a refund?  I have tried to use this converter to change a PDF to a word document or excel document three of four times and it always fails..  I want my money back but don't see any way to communicate with Adobe.  i really just want my money back.  Very disappointed.  Also disappointed that it is so hard to find a way to communicate with Adobe that I have to resort to asking this question in this forum. 

    You need to use the CHAT link in support to reach Adobe staff. Be sure you know the product name you are trying to cancel, Adobe have lots of products, several converters etc. I think it is ExportPDF you have, most likely.

  • I have a big problem with my Iphone 4...the pics and videos that i capture, often shows as inverted or orientted by 90/180/270 degrees. photos, one can rotate, but how about videos... is there any way i'm going wrong? this wasn't happening earlier

    My question...
    any answers pl.
    I have a big problem with my Iphone 4...the pics and videos that i capture, often shows as inverted or orientted by 90/180/270 degrees. photos, one can rotate, but how about videos... is there any way i'm going wrong? this wasn't happening earlier

    If I've understood you correctly then the ALLEXCEPT function may be what you're after and it could be applied in a similar way to the following...
    =
    RANKX(
    ALL(Table1),
    CALCULATE(
    COUNTROWS(table1),
    ALLEXCEPT(Table1, Table1[ContactReason])
    DENSE
    If this has missed the mark, would it be possible to clarify the requirement further?
    Regards,
    Michael Amadi
    Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to vote it as helpful :)
    Website: http://www.nimblelearn.com
    Blog: http://www.nimblelearn.com/blog
    Twitter: @nimblelearn

  • Sir, the subject is, I do not know the original owner Will helped me know that the owner or on the way to end this problem, or any way to communicate with the person in question

    Sir, the subject is, I do not know the original owner Will helped me know that the owner or on the way to end this problem, or any way to communicate with the person in question

    This is a user to user forum.  You are not addressing Apple.  It appears that you may be having issues related to Activation lock: ( http://support.apple.com/kb/PH13695).  If you cannot contact the original owner to have them remove activation lock, you should return the device for a refund.
    HTH

  • MATERIALIZED view on two tables with Fast Refresh

    i Wanted to create MV on two tables with Fast refresh on commit.
    I followed below steps
    create materialized view log on t1 WITH PRIMARY KEY, rowid;
    create materialized view log on t2 WITH PRIMARY KEY, rowid;
    CREATE MATERIALIZED VIEW ETL_ENTITY_DIVISION_ASSO_MV
    REFRESH fast ON commit
    ENABLE QUERY REWRITE
    AS
    select A.ROWID B.ROWID,a.c1, DECODE(a.c1,'aaa','xxx','aaa') c2
    from t1 A
    join t2 b
    on AB.c1= CD.c2;
    i am getting below error.
    Error report:
    SQL Error: ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
    *Cause:    The materialized view did not satisfy conditions for refresh at
    commit time.
    *Action:   Specify only valid options.
    Basically i want to take record in MV by joinig two tables and if both of the base tables will updated then record should reflect in materialised view.
    Please do the needfull.

    does the table support PCT? the other restrictions on joins look to be ok in your statement.
    maybe try creating first with on demand instead of commit to see does it create.
    http://docs.oracle.com/cd/B19306_01/server.102/b14223/basicmv.htm
    >
    Materialized Views Containing Only Joins
    Some materialized views contain only joins and no aggregates, such as in Example 8-4, where a materialized view is created that joins the sales table to the times and customers tables. The advantage of creating this type of materialized view is that expensive joins will be precalculated.
    Fast refresh for a materialized view containing only joins is possible after any type of DML to the base tables (direct-path or conventional INSERT, UPDATE, or DELETE).
    A materialized view containing only joins can be defined to be refreshed ON COMMIT or ON DEMAND. If it is ON COMMIT, the refresh is performed at commit time of the transaction that does DML on the materialized view's detail table.
    If you specify REFRESH FAST, Oracle performs further verification of the query definition to ensure that fast refresh can be performed if any of the detail tables change. These additional checks are:
    A materialized view log must be present for each detail table unless the table supports PCT. Also, when a materialized view log is required, the ROWID column must be present in each materialized view log.
    The rowids of all the detail tables must appear in the SELECT list of the materialized view query definition.
    If some of these restrictions are not met, you can create the materialized view as REFRESH FORCE to take advantage of fast refresh when it is possible. If one of the tables did not meet all of the criteria, but the other tables did, the materialized view would still be fast refreshable with respect to the other tables for which all the criteria are met.

  • Materiazed view with fast refresh

    Hi All,
    I want to create a Materialized view with fast refresh.
    I think for fast refresh we need to set up a materialized view log first before the MV gets created.
    Can someone please provide the steps and the syntax to do this?
    I am new to MV creation so appreciate any help in this regard.
    Thanks.
    AS

    http://www.morganslibrary.org/library.html
    Look up Materialized View Log and Materialized View ... both on the same page ... build the demo MV and you can modify the code to build any others you wish.

  • Any way to force a complete refresh of contacts from Yahoo Address Book?

    Any way to force a complete refresh of contacts from Yahoo Address Book?
    About once a month I delete all my Yahoo contacts and upload a new file. (That may sound crazy but I do it from a master file (a database) both to Yahoo and Lotus Notes and blackberry via Notes. Only takes a few moments. Works for me.)
    When I do this with my iphone it's duplicating some contacts, not a whole lot, but some - maybe 3%. I have reset the sync history before doing this.
    So, any way to wipe the slate clean on the iphone and force a one way refresh?

    Please check you contact name in the device and verify if the names does not start with none alphabetic characters (e.g. @, &, *, etc).  This characters will actually stop the sync process and will not be able to successfully complete the transfer of data. Do the same thing with the contact data you have online just to be sure..
    If that it still doesn't work, delete your Google account on the device, restart, and then recreate the same account.
    Let me know how it goes... 

  • Is there any way, to create with Adobe Muse HTML-Mail Templates?

    Is there any way, to create with Adobe Muse HTML-Mail Templates? or to convert the createt page to only html content? any other tool like an website copyer?
    tanks for help!

    Off the top of my head, you should be able to create mail templates in muse BUT it will require  very basic html/css knowledge on your part. I am assuming you want to do just the signature?
    Create the design you would like on one page, dont do any kind of styling in a master page. Then export the site into a folder. Open the html file with notepad/ textedit and then copy just the code for JUST the template. Throw it in you mail app of choice and it should work.
    This seems like something that would be done alot quicker in dreamweaver in design view.
    PLEASE NOTE: ^i could be completely wrong - but in theory this may work.

  • Replication with fast refresh

    hi everybody,
    I have a problem in replication with fast refresh. I used 2 Windows 2000 server with Oracle 9i Release 9.0.1.1.1 and I can't made the automatic update. This doesn't work and I cant use ON DEMAND.
    I made
    Remote server
    Create table teste (a number primary key, b varchar2(20));
    insert into teste (a, b) values (1, 'weqwuqeui');
    create materialized view log on teste with primary key;
    Server Local --------
    create materialized view admin.teste_mv
    build immediate
    refresh fast start with sysdate next sysdate + 1/1440
    with primary key as
    select * from teste@servidor1;
    Server Remote -------
    insert into teste (a, b) values (2, 'qwerty');
    The first line is in the materialized view teste_mv but the second never appear.
    I know it's a dumb trick but I can't solve this problem at the moment.
    If somebody can help I would appreciate.
    Thanks in advance

    thanks for the reply.
    The job_queue_processes parameter in both servers is set to zero
    The dba_jobs returned the following columns, every other columns are null. The next date and time is in the past.
    JOB LOG_USER 1
    PRIV_USER ADMIN
    SCHEMA_USER ADMIN
    NEXT_DATE 11-JUL-07
    NEXT_SEC 17:45:47
    TOTAL_TIME 0
    BROKEN N
    INTERVAL sysdate + 1/1440 FAILURES
    WHAT dbms_refresh.refresh('"ADMIN"."TESTE_MV"');
    NLS_ENV NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENCY='AMERICA' NLS_NUMERIC_CHARACTERS='.,' NLS_DATE_FORMAT='DD-MON-RR' NLS_DATE_LANGUAGE='AMERICAN' NLS_SORT='BINARY'
    MISC_ENV 0102000200000000
    INSTANCE 0
    Cheers

  • Any way to export with multiple presets at once?

    Hi! Is there any way to export with multiple presets at once? I do a lot of product photography, usually clients send me around 5 to 10 pieces to photograph, and from each photo requires to be exported to about 7 different formats and sizes for different uses. I have a preset for each export, but this requires multiple clicks per export, select the preset, the destination folder, etc.....   and at the end I end taking about 1 hour to just export files when if I could just select 1 time a folder of presets and the destination folder just once, then it will take no time to get all oft those exports.
    Thanks!

    Some of those other photographers have assistants they can task with doing the drudgery.
    I would describe what you're wanting scripted multiple exporting, not multiple export presets, because multiple-exports don't necessarily rely on presets, just initiating an Export and clicking on various things for each one.
    I assume you have a preset set for each of the 7 format-size-uses variations, and then most of the time consuming part is setting the Choosing the destination folder that gets mirrored to DropBox?  You can copy/paste most of the path into the Folder address area after clicking Choose.
    Without knowing what your master-photo folders and dropbox-mirror folder names and organization are it's hard to know if you've thought of all the shortcuts you might use or if things are organized in the most efficient manner.
    If you're on Windows, maybe something like AutoHotKey macros would help with what you're doing.

  • Arlington Historical Society wants to give its visitors the ability to look at our IPhoto files on the Apple computer in our office, but NOT be able to modify them in any way.  How can we do this?

    Arlington Historical Society wants to give its visitors the ability to look at our IPhoto files on the Apple computer in our office, but NOT be able to modify them in any way.  How can we do this?

    Thanks. We want visitors to browse through our historical photos in any of the ways iPhoto will allow them, including slide shows, but also searching for photos by key word and viewing them along with the comments we have entered on that photo.
    I was beginning to think iPhoto had no capability to limit users to certain functions.
    I wonder if the use of Apple's sharing files function would help. I have read that it is possible to share files with others, and to limit their use to viewing only, but I don't know how to do this.

  • Any way to communicate with Serial PORT using JavaScript

    is there any way to communicate with Serial PORT using JavaScript ??
    Dont tell me to do it in java because I need to this on client side not on server side.
    such as when client pressed the button, a javascript function will be called and in that function I need to communicate with the serial port of that client... That action will not go to server side.

    Is there any way to send a string of bytes to the serial port from the client side ?
    Just a button on the web page that sends out stuff to the comport.
    I was hoping to do this using java script also ..

  • I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    I have  license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?

    Download CS6 products
    Mylenium

  • How do I talk to someone about my account and merging two subscriptions together...Can't seem to get to any way to conversing with a human from the website.

    How do I talk to someone about my account and merging two subscriptions together...Can't seem to get to any way to conversing with a human from the website.

    Worst Service In the World
    I just want to cancel my order and get a refund, the company MUST be corrupt because it is nearly Impossible to get what is rightfully mine. It's been 3 years.. how, sad, is that, I got other people to try too...
    they steal from people... by making it impossible to talk to anyone real.

  • Is there any way to sync with new pc? HELP!

    Ok, so I have an ipod touch and a new computer. The old computer that the ipod was synced to was destoyed. Can anyone tell me if there is ANY way to sync with the new pc AND keep all the songs, games, pic, and everything? I don't want to lose everything!!

    There are several shareware utilities that can be used to transfer some of your data such as music files from the Touch to the computer - search for "ipod" at VersionTracker. Contacts and calendar data will sync automatically when you use iTunes to sync the Touch, but be sure to get your music files and pics transferred first. Apps should sync normally.

Maybe you are looking for

  • HT3819 I have movies but no TV shows on my shared iTunes

    I can see movies from all passwords used for my iTunes. My family members share one computer. The Share is my user ID. I can watch my movies but no TV shows apear on my iPad. Since I only have this set up to watch a specific TV show it is been kind o

  • Create return sales order

    Hi, I met some issue needs your help! I use BAPI to create return sales order, Return an error message "Unpermitted combination of business object bus2032 and sales doc.category H". Can anyone suggest me any solution for this problem? Thanks is advan

  • Bring Back the TX!

    The TX is exactly what I need. I have been a happy customer of the TX since it first came out. My one and only complaint is that the touchscreen goes bad quickly. If you fixed that, this is the only device I ever want to carry! With the Outside the B

  • Won't take password

    20+ years of hassle-free Apple, now I buy the Time Capsule. Six hours and counting and I'm still not set up. Finally have it recognized as my base station, and the internet working, but Time Machine is asking for my "User name and password". Is this

  • Computer not powering down

    Something interesting cropped up today - my iBook will not shut down using the normal method. I tried Apple>Shut Down>Shut Down, I tried Apple>Shut Down and then letting the count down expire, and lastly, when I hit the power button, I clicked on the