How can I create a materialized view based on hierarchical cube query?

Hi,
database version 10gR2.
When i try to create MV for sql below, i got error .
I tried creating MV log in several ways, but still, keep getting the same error.
SQL Error: ORA-12015: cannot create a fast refresh materialized view from a complex query
12015. 00000 -  "cannot create a fast refresh materialized view from a complex query"
*Cause:    Neither ROWIDs and nor primary key constraints are supported for
           complex queries.
*Action:   Reissue the command with the REFRESH FORCE or REFRESH COMPLETE
           option or create a simple materialized view.So, I wonder if it is possible to create MV based on sql below?
if yes, how should I do it?
if no, what is the alternative?
select
      coalesce(UP_ORG_ID_6, UP_ORG_ID_5, UP_ORG_ID_4, UP_ORG_ID_3, UP_ORG_ID_2, UP_ORG_ID_1) as ORG_ID,
      a.day_id as day_id,     
      a.TRADE_TYPE_ID as TRADE_TYPE_ID,
      a.CUST_ID,
      coalesce(UP_CODE_6, UP_CODE_5, UP_CODE_4, UP_CODE_3, UP_CODE_2, UP_CODE_1) as product_id,
      QUANTITY_UNIT,
      COST_UNIT,
      A.SOURCE_ID as SOURCE_ID,
      SUM(CONTRACT_AMOUNT) as CONTRACT_AMOUNT,
      SUM(CONTRACT_COST) as CONTRACT_COST,
      SUM(SALE_AMOUNT) as SALE_AMOUNT,
      SUM(SALE_COST) as SALE_COST,
      SUM(ACTUAL_AMOUNT) as ACTUAL_AMOUNT,
      SUM(ACTUAL_COST) as ACTUAL_COST,
      SUM(TRADE_COUNT) as TRADE_COUNT     
from DM_F_LO_SALE_DAY a, DM_D_ALL_ORG_FLAT B, DM_D_ALL_PROD_FLAT D
where a.ORG_ID=B.ORG_ID
      and a.PRODUCT_ID=D.CODE
      and a.day_id=20110201
group by rollup(UP_ORG_ID_1, UP_ORG_ID_2, UP_ORG_ID_3, UP_ORG_ID_4, UP_ORG_ID_5, UP_ORG_ID_6),
      a.TRADE_TYPE_ID,
         a.day_id,
      A.CUST_ID,
      rollup(UP_CODE_1, UP_CODE_2, UP_CODE_3, UP_CODE_4, UP_CODE_5, UP_CODE_6),
      a.QUANTITY_UNIT,
      a.COST_UNIT,
      a.SOURCE_ID;Thanks in advance.

Rob vanWjik has an excellent series of fast refresh materialized views starting here:
http://rwijk.blogspot.com/2009/05/fast-refreshable-materialized-view.html
Part three specifically on aggregate MVs is here:
http://rwijk.blogspot.com/2009/06/fast-refreshable-materialized-view.html

Similar Messages

  • How can I rename a materialized view

    I want to rename a materialized view I don't want to recreate it takes too long.
    Help...

    Unfortunately you can't rename a materialized view :
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10736/advmv.htm#sthref589
    But you can
    1) Create a synonym
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/statements_7001.htm#sthref5356
    Or
    2 )If your materialized view was created based ON PREBUILT TABLE, you can drop it without losing the underlying table.
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/statements_8019.htm#sthref6247
    And then you can recreate a new materialized view based on PREBUILT TABLE.
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/statements_6002.htm#i2106785
    Best regards,
    Franck.

  • Can we create a Materialized View with Parameters?

    Experts,
    Can we create a materialized view by passing parameters to it. so that we change its value dynamically.
    If yes, plese provide me the eample also.
    Regards
    ND

    I have below mentioned query to be used in MV :
    SELECT ivr_vw.event_type, ivr_vw.event_sub_type,
    ivr_vw.channel_cd,
    ivr_vw.csg_event_id,
    ivr_vw.csg_title,
    ivr_vw.itv_title,
    ivr_vw.program_id,
    ivr_vw.price,
    ivr_vw.addt_flag,
    (SELECT FROM_TZ(TO_TIMESTAMP (TO_CHAR (to_date(ivr_vw.start_date,'MM/DD/YYYY HH24:MI:SS'), 'MM/DD/YYYY HH24:MI:SS'),
    'MM/DD/YYYY HH24:MI:SS' ), 'EST')
    AT TIME ZONE 'MST' FROM DUAL) start_date,
    (SELECT FROM_TZ(TO_TIMESTAMP (TO_CHAR (to_date(ivr_vw.end_date,'MM/DD/YYYY HH24:MI:SS'), 'MM/DD/YYYY HH24:MI:SS'),
    'MM/DD/YYYY HH24:MI:SS' ), 'EST')
    AT TIME ZONE 'MST' FROM DUAL) end_date,
    (SELECT FROM_TZ(TO_TIMESTAMP (TO_CHAR (to_date(ivr_vw.start_order_window,'MM/DD/YYYY HH24:MI:SS'), 'MM/DD/YYYY HH24:MI:SS'),
    'MM/DD/YYYY HH24:MI:SS' ), 'EST')
    AT TIME ZONE 'MST' FROM DUAL) start_order_window,
    (SELECT FROM_TZ(TO_TIMESTAMP (TO_CHAR (to_date(ivr_vw.end_order_window,'MM/DD/YYYY HH24:MI:SS'), 'MM/DD/YYYY HH24:MI:SS'),
    'MM/DD/YYYY HH24:MI:SS' ), 'EST')
    AT TIME ZONE 'MST' FROM DUAL) end_order_window,
    ivr_vw.dnis_cd, ivr_vw.packaged_event_id, ivr_vw.no_instalments,
    ivr_vw.disclaimer_flag, ivr_vw.english_voice_file_name,
    ivr_vw.spanish_voice_file_name, ivr_vw.package_flag,
    ivr_vw.is_all_day_event, ivr_vw.upsell_data, ivr_vw.dur_guaran_flag,
    ivr_vw.cp_profile_id, ivr_vw.high_def_flag
    FROM ppv_ivr_vw ivr_vw,
    (Select time_diff,
    use_daylight
    From ppv_zip_timezones ztz
    Where ztz.zip_code = 80014
    ) timeOffset
    WHERE NOT EXISTS (
    SELECT 'x'
    FROM ppv_channels_blackout_vw blk_vw
    WHERE ivr_vw.channel_cd = blk_vw.channel_cd
    AND blk_vw.zone_type_code = 'Area Code'
    AND blk_vw.zone_code = '435');
    Here, the column 'ztz.zip_code = 80014' should change dynamically as per the request of the user.
    Is it possible. If yes, what is the process of doing so.?
    Regards
    ND

  • How can I create UI components dynamically based on the result of WebService/HttpService call?

    I would like to create child components of the component
    based on a XML which is retrieved by WebService/HttpService call.
    createChildren() is the one to be used to create components
    dynamically. But if I use createChildren() and call a
    WS/HttpService request in createChildren method, I can not get the
    result of WS/HttpService request in createChildren().
    It seems that the result event is processed later after
    createChildren() is completed.
    How can I implement my requirement?
    I would appreciate any pointer or suggestion.
    Best regards
    Masa

    1) Use a List, with a custom itemRenderer
    2) Use a Repeater (Probably easiest)
    3) use Actionscript to addChild() components.
    Tracy

  • How can i create a dynamic structure based on my input from a select-option

    Hello,
    This is to develop a custom report in FI for G/L Balance based on company code.
    I have an input select-option for Company code.
    Based on the range of company code my output layout should be modified.
    I am not very much sure to create a dynamic internal based on the input from a select-option.
    Can any one please let me know how can i do this.
    I would appreciate for anyone who turns up quickly.
    Thank you,
    With regs,
    Anitha Joss.

    See the following program, it builds a dynamic internal table based on the company codes from the select option. 
    report zrich_0001 .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    data: it001 type table of t001 with header line.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_bukrs for it001-bukrs.
    selection-screen end of block b1.
    start-of-selection.
      select * into table it001 from t001
                     where bukrs in s_bukrs.
      perform build_dyn_itab.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = 'PERIOD' .
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
      loop at it001.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = it001-bukrs .
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        append wa_it_fldcat to it_fldcat .
      endloop.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Regards,
    Rich Heilman

  • How can i create a Matrix View or Matrix Report in JDeveloper

    Dear All
    I'm tring to creat an updatable view display (items , customer , quantity)
    The customer must be Distinct
    , And the view column are not fixed (Like the Matrix Reports)
    Example
    customers___________item01___________item02___________item03----------item_N
    dan_________________5_______________10_____________15 -----------
    sara________________12_______________7______________3 -----------
    How can i display that in ADF table ?
    It's Possible to make that view updateable
    Thanks
    Ahmed Galal

    May I suggest that you ask this question in the customer forums in the Business Center at [http://sme.sap.com|http://sme.sap.com]
    Best regards, Christian

  • How can I create a Table View in Cocoa Applescript?

    This is my last resort. I've searched for days and only found tutorials for iPhone and Cocoa, and I have no idea where to start. I'm looking for a way to create a Table View, and fill it with a few cells that call a handler when clicked. I've looked through the Xcode help, the Apple documentation, and countless tutorials, and I don't know what to do. I'm sure what I'm asking is possible, because usually what is possible in Cocoa is possible in Cocoa-Applescript.
    Perhaps something like:
    myTableView's addCell_OfType_WithHandler("This is a text cell", text, "myHandler:")
    I would appretiate any responses and brief descriptions on the matter.

    You did not answer my first question, which was not an idle question. I'll answer here, but if cross-chatter appears in a different thread I'll ignore it. You'll have to keep track of the mess yourself.
    Apple_For_The_Win wrote:
    At this point, I've dragged a Table View onto my window, in Xcode. I've connected it to the value "myTableView", and that's where I need help. I'm specifically trying to add cells into the table view.
    I'll assume that 'connected it to the value "myTableView"' means that you've control-dragged in XCode from the table view in Main Menu.xib to a property in your applescript app delegate called myTableView. If that's not the case, please correct me.
    I prefer to use an array controller for this, so please drag an array controller object into main menu.nib. once you've done that, do the following:
    open the applescript app delegate and add a new property called "tableController"
    select the table view in the object list (you may need to open some disclosure triangles to reach it). and add appropriate (an) column name(s). you can hide column titles later if you like, but having named columns makes life easier.
    select the array controller in the object list
    rename the array controller "table data"
    open the attributes inspector, and then add the column name(s) as key(s) in the object controller area
    open the bindings inspector, and where it says "controller content", open the disclosure arrow and bind the content to the App Delegate object on the model key path self.tableController
    select the table view in the object list again, then go down a level and select each column in turn
    for each column, open the bindings inspector, and where it says "value", open the disclosure arrow and bind the content to the Table Data object with the controller key arrangedObjects model key path being the name of the column (which is the name of the key in the controller as well)
    back in the applescript app delegate, add code like the following:
      -- create a list of records, where each record represents a row and the column name is the record key
      set myData to {{column_1_name:"hello"}}
      -- convert it to an NSArray and add it to the controller content. don't forget the *my* keyword, or it won't work
      set my tableController to NSArray's arrayWithArray:myData
      -- may or may not be needed
      myTableView's reloadData()
    That should populate the table with simple text. if you want something more complicated (like buttons or links) then create the more complicated elements separately and add them to the data.

  • How can i create Inventory FIFO (FIRST IN FISRT OUT ) stock query ?

    I want to create  Inventory FIFO query from this
    I have a receive item table to store the receive item (IN) and i have requisition table  (OUT).
    I want to create a FIFO query  order by
    receiveID , the output i expect is
    How can i do this ?

    declare @Stock table (Item char(3) not null,[Date] datetime not null,TxnType varchar(3) not null,Qty int not null,Price decimal(10,2) null,ReqNo varchar(4) null)
    insert into @Stock(Item ,  [Date] ,        TxnType, Qty,  Price , ReqNo) values
    ('ABC','20120401','IN',    200, 750.00 ,null),
    ('ABC','20120405','OUT',   100 ,null , 'R001'  ),
    ('ABC','20120410','IN',     50, 700.00 ,null),
    ('ABC','20120416','IN',     75, 800.00 ,null),
    ('ABC','20120425','OUT',   175, null  , 'R002' ),
    ('XYZ','20120402','IN',    150, 350.00 ,null),
    ('XYZ','20120408','OUT',   120 ,null  , 'R003' ),
    ('XYZ','20120412','OUT',    10 ,null  , 'R004' ),
    ('XYZ','20120424','IN',     90, 340.00 ,null);
    ;WITH  RunningTotals as (
    select A.Item , A.Qty , A.Price ,  A.Total , total - A.qty AS PrevTotal,  rn FROM (
    select 
    Item , qty , Price
    , SUM(Qty) over (PARTITION BY Item order by [Date] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as total 
    ,ROW_NUMBER() OVER (PARTITION BY Item ORDER BY  [Date] ) as rn
    ,[Date]  
    from @Stock where TxnType = 'IN' )  A 
     )-- Select * from  RunningTotals    -- >> Sort FIFO by date
    , TotalOut as (
        select ReqNo , Item,SUM(Qty) as Qty  from @Stock where TxnType='OUT' group by Item , ReqNo
    ) Select * from TotalOut -- >> Item that out FIFO
    I want to get the price of any item in any ReqNo from RunningTotals by FIFO

  • How can I create a responsive website based in Adobe Muse?

    I already created a website with Adobe Muse but I just find out that it doesn't support Responsive Websites. What can I do now? Is there a way to make my website responsive or do I have to redesign it?

    Hi there! I`d recommend you to try create website from a ready-made template rather than from very start-up. It`s much easier. I like website templates based upon Joomla http://www.templatemonster.com/joomla-templates.php . Feel free to address it and convience yourself it`s as simple as rolling off a log. Good luck!

  • How can I create only SPRO view role?

    Hello,
    On my production server I want to create a role for SPRO view. How it is possible?
    Please help me
    regards
    Kariyath

    Hello Kariyath,
    Please check this thread for this purpose:
    Re: Transaction List in SPRO
    This thread allows you to have all transactions in SPRO in a role.
    Next you need to change activities to 03. Make sure you remove authorization objects like s_admi_fcd,s_btch_nam,s_cts_admi etc from this role.
    regards.
    ruchit.

  • How to create materialized view based on a synonym

    Hi all,
    I am trying to create simple materialized view based on a synonym and that synonym is pointing a view in other database (using dblink). I am getting table or view not found error . I am able to select synonym if i use select but not in materialized view. Please help me.
    Thanks,

    The best way to do this is to create a materialzed view based on the underlying code of the original view. If you don't have this handy, issue the following in sqlplus:
    select text
    from user_views
    where view_name = 'NAME_OF_VIEW'
    You can then cut and paste the sql statement into your create materialized view statement.
    Please note, you will probable have to set the long parameter to a higher value to reveal the complete statement for example:
    SQL> set long 2048

  • Create Materialized View based on Results from LDAP Query

    Hi -- I'm trying to create a materialized view based on results from an LDAP query. Unfortunately, it looks like a materialized view can't be created based on a stored procedure, which is where the LDAP results are obtained (using nested loops).
    Does anyone have any idea how to do this without first kicking off a stored procedure that populates a temp table which would be used to create the materialized view? I'm trying to minimize the steps that the DBA's will need to go through when refreshing this new view.
    Thanks,
    ~Christine

    Can you give us more details about the stored procedure you're calling. It will help to know what parameters are involved and what data types they are.
    Off the top of my head though it looks like, at the very least, you would need a stored function that calls the stored procedure. I don't think there is any way to call stored procedures from CREATE ... commands. If you're going to create a stored function anyway ... well, you might as well just create a procedure that inserts values into a regular table instead of fussing with functions and materialized views. You'll probably want to schedule your new procedure to run periodically since it sounds like you'll need the values refreshed from time to time.

  • How can I view my photos in "Events" like in iPhoto? How can I create events?  I have 55,000 photos and 1700 events so the only way I can possibly manage my photos is using events that are one slide in size.

    I have 55,000 images organized into about 1700 events. The only reasonable way to view my library is using events in iPhoto where each event has one image That still leaves 1700 images to sort through but that is a lot easier than 55,000 images.  In the side bar is a folder with "iPhoto Events" but those views still show all of the slides.  How can I create events and view my photos as events as in iPhoto?  Events are critical for large libraries and has been my primary way to sort images.
    Thanks!

    I had a problem a couple of months ago when iPhotos suddenly rearranged the order of my Events (Why won't iPhoto let me arrange my photos?) .  I was told "Use albums not events - events are not a good way to organize - albums and folder are designed for organisation and are very flexible".
    Haha!  I should have paid attention and read between the lines!  My iPhotos were highly organised groupings - not according to date but the way I wanted them - and it was so easy to do!  I see now that if I had them all in albums, as per the Apple Apologist suggestion, I wouldn't have this unholy mess I have been left with just to make iPhone & iCloud users happy.  I am now going through Photos and making Albums (of what used to be in my Events)  ... maybe I'll get this finished before they do another non user friendly update!

  • Create a materialized view :-

    How do I create a materialized view on a view ,so that it will refresh automatically on every commit in base table where the view having more that 9 function ?

    Read Materialized View Refresh for complete information.
    For a Jist:
    Refresh Mode Description
    ON COMMIT
    Refresh occurs automatically when a transaction that modified one of the materialized view's detail tables commits. This can be specified as long as the materialized view is fast refreshable (in other words, not complex). The ON COMMIT privilege is necessary to use this mode.
    ON DEMAND
    Refresh occurs when a user manually executes one of the available refresh procedures contained in the DBMS_MVIEW package (REFRESH, REFRESH_ALL_MVIEWS, REFRESH_DEPENDENT).
    When a materialized view is maintained using the ON COMMIT method, the time required to complete the commit may be slightly longer than usual. This is because the refresh operation is performed as part of the commit process. Therefore this method may not be suitable if many users are concurrently changing the tables upon which the materialized view is based.
    If you anticipate performing insert, update or delete operations on tables referenced by a materialized view concurrently with the refresh of that materialized view, and that materialized view includes joins and aggregation, Oracle recommends you use ON COMMIT fast refresh rather than ON DEMAND fast refresh.
    If you think the materialized view did not refresh, check the alert log or trace file.
    If a materialized view fails during refresh at COMMIT time, you must explicitly invoke the refresh procedure using the DBMS_MVIEW package after addressing the errors specified in the trace files. Until this is done, the materialized view will no longer be refreshed automatically at commit time.

  • Grand Total Not working on Materialized view based table ??

    Hi all,
    I have a complex report report by using sum and decode function. I precalculated my requirment in database and then create a materialized view based on my sql statement. I import this view in physical and BM model and its results very fine and efficient. But the problem create when I implement Grand Total on my report in table view it did'nt work means (Grand Total is not working on this MV based table) Any idea why ??
    any reply would by higly appriciated.
    Regards

    Hi Zishan,
    Check the Aggregation Rule and set it to sum in the table view.
    That is go to the "edit formula" tab of the column for which you want grand total and set that to sum.
    Hope this will help.
    Thanks
    Ashok

Maybe you are looking for