Help to create Materialized View that has timestamp conversion

I need help creating materialized view with timestamp conversion between GMT to LocalTime.
Feel free to make any comments.
Thanks in advance.
jon joaquino;)

Here is one way.
1. Alter the table hist_table and add a new column pdt_timestamp.
2. Update the new column using the function 'new_time'
For example,
Update hist_table
set pdt_timestamp = new_time(gmt_timestamp,'GMT','PDT');
3. create a materialized view log on the table 'hist_table' using the syntax
create materialized view log on hist_table
with primary key, rowid, sequence;
4. create a materialized view now using the syntax:
(You have to specify your own storage numbers and tablespace name)
create materialized view mview_hist_table
pctfree 0 tablespace mymview
storage (initial 16k next 16k pctincrease 0)
build immediate
refresh fast on commit
as select uid,gmt_timestamp,pdt_timestamp
from hist_table;
Please test on your test instance before doing it on production. I have tested this on Oracle 10g for Windows 2000. I assumed that column 'uid' is the primary key on the table. I hope this helps.
**********************************************************

Similar Messages

  • Creating Materialized View with the Distinct key word

    Hi
    I need help to create Materialized View with the Distinct key word.
    my query is
    select distinct col1, col2 from t1;
    is there any alternate of DISTINCT because I can not refresh the MV as fast on demand if I am using it and Fast on Demand is a must for me.

    hi
    check out this link
    http://download-west.oracle.com/docs/cd/B12037_01/server.101/b10736/basicmv.htm#i1007299
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/intro.htm#sthref183
    hope this helps
    CHeers

  • Creating materialized view with variables - help

    Greetings,
    I want to create an materialized view (MV) from the external public db link. Below is my full query:
    CREATE MATERIALIZED VIEW PROJECTS_MV
    REFRESH WITH ROWID
    AS
    SELECT prj.Project_id, prj.desc,
    prj.parent_project_id, f_year, f_month
    FROM sysadm.prj@EFUYEEDW_DB_LINK.MSDB prj
    WHERE prj.pf_scenario_id = '708KDD'
    AND prj.ph_id = 'SHAREDP'
    AND f_year = (SELECT EXTRACT(year FROM current_DATE) FROM dual)
    AND f_month = (SELECT EXTRACT(month FROM current_DATE) FROM dual)
    Question: In the query there are two variables that capture the month and year and requery it. Does the data get updated automatically when a new month or new year changes?
    If there is a change, how would I change so it would update the data accordingly?
    Thanks for your help
    john9569

    Hi Christian,
    Thanks for your response. Your codes return the date as 01-JAN-09 which is not what I'm looking for. Maybe my question is not clear.
    So far, the MV is executed correctly what I want. My concern is when it updates the MV, does it get the new data (f_month & f_year) when the MV is updated automatically?
    Other words, the MV is updated nightly to get the incremental data from the db link. Once it passes to the new month, I am not sure how this MV handles since the f_month is now changed to differrent number.
    Thanks for your help.
    Bests,
    John9569

  • Creating Materialized View in Toad

    As with every new endeavor - come new questions.
    I am trying to create a materialized view via toad (first time doing this). Now - toad is great, since it provides a kind-of wizard interface. Hence, one doesn't have to completely code in the create statement, with all of the options, etc.
    Instead, in toad, one can (via the schema browser), go into the Materialized Views tab and click on create new. This opens a window with 6 tabs: Basic Info, Refresh Info, Physical Attributes, Query, Partitions & Subpartition Template.
    In the Basic Info, one can put a check mark next to some of the following options:
    -Build Deffered
    -Parallel
    -Cache
    -Logging
    -Using index
    -Allow updates
    etc.
    I have read that build deferred refers to whether or not you would like the view to be created automatically or to be deferred.
    Anyways, I tried to find Toad documentation to explain each of the options in-detail. No success. Hence, am researching each part piece by piece.
    But - here is my question:
    In the Query tab, we are asked to specify a query. I am assuming that the query does not have to be a full query, beginning with CREATE MATERIALIZED VIEW mv_table1 REFRESH FAST etc...
    Since in this 'wizard', we are providing the MV name at the top of the dialog box, we are checking the 'options' in the other tabs, etc.
    And so, I assumed that the query should merely be a select query in the window mentioned above.
    So I entered the following:
    select * from table1@remote_db;
    When I go to verify the syntax, I get the error message: ORA_00911: invalid character. It seems to be pointing to my db_link (remote_db). I have been using this link throughout many places, w/o any problems.
    Has anyone created a MV in toad before? Any links to good toad documentation would be helpful as well.
    Thanks.

    (This is fun... ;))
    For anyone endeavoring this in the future, below I have attached the prerequisites required in order to create a materialized view (can also be found @ http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm):
    Prerequisites
    The privileges required to create a materialized view should be granted directly rather than through a role.
    To create a materialized view in your own schema:
    You must have been granted the CREATE MATERIALIZED VIEW system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
    You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a materialized view in another user's schema:
    You must have the CREATE ANY MATERIALIZED VIEW system privilege.
    The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database) and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a refresh-on-commit materialized view (ON COMMIT REFRESH clause), in addition to the preceding privileges, you must have the ON COMMIT REFRESH object privilege on any master tables that you do not own or you must have the ON COMMIT REFRESH system privilege.
    To create the materialized view with query rewrite enabled, in addition to the preceding privileges:
    If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside the schema.
    If you are defining the materialized view on a prebuilt container (ON PREBUILT TABLE clause), then you must have the SELECT privilege WITH GRANT OPTION on the container table.
    The user whose schema contains the materialized view must have sufficient quota in the target tablespace to store the master table and index of the materialized view or must have the UNLIMITED TABLESPACE system privilege.
    When you create a materialized view, Oracle Database creates one internal table and at least one index, and may create one view, all in the schema of the materialized view. Oracle Database uses these objects to maintain the materialized view data. You must have the privileges necessary to create these objects.

  • Error on creating Materialized view.

    Hi,
    I don't understand why it happens...
    When I tried to creating materialized view, it shows a error "ORA-01013: User requested cancel of current operation".
    I don't understand why it happens. I just waited it successfully created. But I didn't press any button.
    Does it matter of size of joining table? I had same issue before. At that time I just removed some tables from the joining condition, this error was gone.
    But at this time, I cannot exclude any other tables the select statement
    Can anyone help me this issue, please?

    Hi,
    11g ( 11.2.0.3 ) has a problem with materialized views based on ROWID, resulting in the problem you mentioned.
    A workaround is creating the MV's based on primary keyl.
    There is also a patch available on MOS, to solve the problem ( thanks to a very long SR from me :-) )
    It is known as bug 13657605 and the patch for it has the same number.
    Remember to read the README, as this patch is only for 11.2.0.3 !!
    Cheers
    FJFranken

  • Create materialized view with ora-12054 error

    Oracle 10g R2 on AIX 5.3L
    I create a script (with help of EM) for a materilaized view
    CREATE MATERIALIZED VIEW "BAANDB"."R2_MV"
    TABLESPACE "USERS" NOLOGGING STORAGE ( INITIAL 128K) USING INDEX TABLESPACE "BAANIDX" STORAGE ( INITIAL 256K)
    REFRESH FORCE ON COMMIT
    ENABLE QUERY REWRITE AS
    SELECT CM.ROWID c_rid, PC.ROWID p_rid, CM."T$CWOC", "T$EMNO", CM."T$NAMA", CM."T$EDTE", PC."T$PERI", PC."T$QUAN", PC."T$YEAR", PC."T$RGDT" From BAANDB.TTPPPC235201 PC RIGHT OUTER JOIN BAANDB.TTCCOM001201 CM Using (T$EMNO)
    but I got error
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    acooding to the oerr
    // *Cause:  The materialized view did not satisfy conditions for refresh at
    // commit time.
    // *Action: Specify only valid options.
    what dose it mean? both my master tables are not IOT and are locale ones. It seems that only changing to ON DEMAND works. If I use the "REFRESH FORCE START ..NEXT", it also failed.
    I have created the materalized view logs with rowid on each master table. I think my script met every prequirement of ON COMMIT.
    table owner has "on commit refresh" privilege

    After googling on line, someone mentioned that for "ON COMMIT" on join tables, we have to use th old OUTER JOINT syntax (+) on WHERE. The new "outer joint" in FROM clause won't work.
    I tested it, it seemed to be true.

  • End of communication channel on creating Materialized view

    Dear All,
    I've Oracle Enterprise Edition(ver 9.0.1.1.1) running on Windows Xp Home Edition, When I run the following statement to create a materialized view I got the famous error ORA-03113: end-of-file on communication channel.And the strange thing is that after this I got disconnected from the database and when I tried to reconnect it showed an Error "Shared memory not available". I was forced to restart my database.
    CREATE MATERIALIZED VIEW CUVF_MVIEW
    TABLESPACE USERS
    NOCACHE
    NOPARALLEL
    BUILD IMMEDIATE
    REFRESH COMPLETE
    ON DEMAND
    START WITH
    TO_DATE('08-DEC-2003 11:00:00','dd-mon-yyyy hh24:mi:ss')
    NEXT trunc(sysdate) +13/24
    WITH ROWID
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE AS
    SELECT *
    FROM mySchema.Trasaction_FACT@test_link cuvf
    WHERE
    REFERENCE_DT BETWEEN TRUNC(ADD_MONTHS(SYSDATE,-1),'MON')
    AND LAST_DAY(TRUNC(ADD_MONTHS(SYSDATE,-1),'MON'))

    Like other poster suggested, please post some sample code, query your used to build the view (you can scramble the real table/column name as your wish) and the actual screen capture of the error.
    This will help others to help you. Right now you are only describing symptoms while no one has idea what it really is.

  • Create materialized view is failing when refresh fast is used

    version 10.2.0.4 on solaris
    This statement is working fine
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    BUILD IMMEDIATE
    as
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    The statement with fast refresh is failing with this error message
    ERROR at line 18:
    ORA-12018: following error encountered during code generation for
    "TABLE1"
    ORA-00942: table or view does not exist
    Here is the statement
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    USING INDEX TABLESPACE MIS_CURI01
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    Any idea what's going wrong here. Thanks for your help in advance.
    Edited by: user11319873 on Jun 30, 2010 4:17 PM

    Refresh FAST requires that
    a. An MV Log (Snapshot Log) be created on the source table
    b. The user doing the refresh (i.e. the account that the DBLink uses) has SELECT privilege on the MV Log.
    Hemant K Chitale

  • Create Materialized View ORA-01723: zero-length columns are not allowed

    I am trying to create a materialized view which derives a column from a function and I get: ORA-01723: zero-length columns are not allowed.
    I am using 10gR2 with the following definition (simple version):
    CREATE MATERIALIZED VIEW AS
    SELECT
    function_name(column_name) COLUMN_ALIAS
    FROM table_name;
    I have even tried to cast it like below:
    CREATE MATERIALIZED VIEW AS
    SELECT
    CAST(function_name(column_name) AS VARCHAR2(200)) COLUMN_ALIAS
    FROM table_name;
    My function does have an exception to return a value even if no values are found.
    I have looked all over for the solution. Does anyone have a way around this issue? I really need my function to derive the column as it has business rules which I cannot join into my materialized view definition. My only hope around this is to insert the values into a table and then create a materialized view from that table, I don't want to do that if someone has a solution around this.
    Any help would be greatly appreciated.
    Thank you,
    Kyle
    Edited by: Kyle Miller on Apr 19, 2011 8:28 AM

    Have you tried creating a table with the correct structure and then creating the materialized view based on the prebuilt table as described here...
    http://www.oaktable.net/content/ultra-fast-mv-alteration-using-prebuilt-table-option
    Cheers
    Ben

  • Need help on tuning materialized view refresh

    Hi All,
    I am working on materialized view refresh tuning.Initially it was complete refresh and used to take more than 90 mins to complete.
    I changed it to fast refresh now it is completing fast. Now i have partitioned the base tables gl_balances and gl_code_combinations of column code_combination_id and created a local index on column code_combination_id then i am trying to partition the materialized on the same column to take advantage of partition change tracking.
    Size of gl_balances base tables is 40Gb and all others tables sizes are small. In where clause there all the 4 tables are mapped. If i will create the partition only on code_combination_id will i the materialized will become the candidate for partition change tracking. As i know it will be applicable for PCT. I need expert advice on this.
    While doing a fast refresh. the refresh takes less time. when there is a change in gl_balances , gl_code_combinations or gl_periods it completes in 20-30 mins. When there is a change in gl_set_of_books tables. It creates a problem here.DEL query takes more than 48 hours to complete.
    CREATE MATERIALIZED VIEW apps.BAL_PART
    REFRESH FAST ON DEMAND
    ENABLE QUERY REWRITE as
    SELECT GL.GL_CODE_COMBINATIONS21.ROWID C1,GL.GL_BALANCES21.ROWID C2, GL.GL_SETS_OF_BOOKS.ROWID C3,
    GL.GL_PERIOD.ROWID C4,
    "GL"."GL_BALANCES21"."ACTUAL_FLAG" ,
    "GL"."GL_BALANCES21"."CURRENCY_CODE" ,
    "GL"."GL_BALANCES21"."PERIOD_NUM" ,
    "GL"."GL_BALANCES21"."PERIOD_YEAR" ,
    "GL"."GL_BALANCES21"."SET_OF_BOOKS_ID" "SOB_ID",
    "GL"."GL_CODE_COMBINATIONS21"."CODE_COMBINATION_ID" "CCID",
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT1" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT10" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT11" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT12" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT13" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT14" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT2" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT3" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT4" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT5" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT6" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT7" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT8" ,
    "GL"."GL_CODE_COMBINATIONS21"."SEGMENT9" ,
    "GL"."GL_PERIODS"."PERIOD_NAME" ,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal_Cr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) Open_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Close_Bal_Dr,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) Open_Bal,
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_DR", 0) -
    NVL("GL"."GL_BALANCES21"."BEGIN_BALANCE_CR", 0) +
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) -
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Close_Bal,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_CR", 0) Period_Cr,
    NVL("GL"."GL_BALANCES21"."PERIOD_NET_DR", 0) Period_Dr
    FROM GL.GL_CODE_COMBINATIONS21,
    GL.GL_BALANCES21,
    GL.GL_SETS_OF_BOOKS,
    GL.GL_PERIODS
    WHERE GL.GL_BALANCES21.CODE_COMBINATION_ID =GL.GL_CODE_COMBINATIONS21.CODE_COMBINATION_ID
    AND GL.GL_SETS_OF_BOOKS.SET_OF_BOOKS_ID = GL.GL_BALANCES21.SET_OF_BOOKS_ID
    AND GL.GL_PERIODS.PERIOD_NUM = GL.GL_BALANCES21.PERIOD_NUM
    AND GL.GL_PERIODS.PERIOD_YEAR = GL.GL_BALANCES21.PERIOD_YEAR
    AND GL.GL_PERIODS.PERIOD_TYPE = GL.GL_BALANCES21.PERIOD_TYPE
    AND GL.GL_PERIODS.PERIOD_NAME = GL.GL_BALANCES21.PERIOD_NAME
    AND GL.GL_PERIODS.PERIOD_SET_NAME = GL.GL_SETS_OF_BOOKS.PERIOD_SET_NAME
    and gl.GL_CODE_COMBINATIONS21.summary_flag != 'Y'TRACE 1046 del statement
    DELETE FROM "APPS"."apps.BAL_PART" SNA$
    WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT 
      CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM "GL"."MLOG$_GL_SETS_OF_BOOKS"
      "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1 ) AS OF SNAPSHOT(:B_SCN) MAS$)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1  17759.00  171782.99  159422121    1267371 2564144739           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2  17759.00  171782.99  159422121    1267371 2564144739           0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 175  (APPS)   (recursive depth: 1)
    Rows     Row Source Operation
          0  DELETE  apps.BAL_PART (cr=0 pr=0 pw=0 time=0 us)
    193128740   NESTED LOOPS  (cr=592437 pr=592422 pw=0 time=945244160 us cost=339302 size=168 card=1)
          3    SORT UNIQUE (cr=7 pr=0 pw=0 time=15832 us cost=2 size=138 card=1)
         24     TABLE ACCESS FULL MLOG$_GL_SETS_OF_BOOKS (cr=7 pr=0 pw=0 time=19 us cost=2 size=138 card=1)
    193128740    INDEX RANGE SCAN C3BOOKS (cr=592430 pr=592422 pw=0 time=789499200 us cost=339299 size=3318314250 card=110610475)(object id 2114736)
    error during execute of EXPLAIN PLAN statement
    ORA-08187: snapshot expression not allowed here
    parse error offset: 314
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                   159520897        2.12     144415.96
      latch: cache buffers chains                   134        0.06          0.68
      latch: undo global data                        33        0.02          0.15
      latch: object queue header operation          521        0.02          0.53
      log file switch (private strand flush incomplete)
                                                    532        0.31         28.26
      resmgr:cpu quantum                            155        1.40         13.49
      resmgr:internal state change                   25        0.11          2.21
      latch free                                     10        0.00          0.00
      latch: cache buffers lru chain                  4        0.00          0.00
      rdbms ipc reply                               489        0.02          0.54
      reliable message                              587        0.00          0.56
      latch: row cache objects                        3        0.00          0.00
    ********************************************************************************GL_SETS_OF_BOOKS has only 6 rows. I know there is complete refresh as a option which will again take more than 90 mins.
    I want to do the fast refresh. Tables rows details below.
    SQL> select count(*) from gl.gl_code_combinations21;
    COUNT(*)
    3075255
    SQL> select count(*) from gl.GL_PERIODS;
    COUNT(*)
    1160
    SQL> select count(*) from gl.gl_balances21;
    COUNT(*)
    477613527
    SQL> select count(*) from gl.gl_sets_of_books;
    COUNT(*)
    6gl_sets_of_books has less rows. Whenever there is a change then it mapped to huge rows hence during materialized view has delete huge number of rows.
    select count(*) from apps.BAL_PART group by C3;
    C3 is the rowid which is present in create materialized statement.
    COUNT(*)
    292927011
    210215
    69330
    184406971
    Is there any way to improve the plan. As i created a partition on code_combination_id and local index on code_combination_id which will not help in set_of_books_id case. I dont PCT will help here or not. Is it possible to use PCT refresh by equipartitioning only one column in where clause.
    Please assist me in improving refresh of materialized view using fast refresh.
    Thanks and Regards,
    Edited by: user646034 on Feb 23, 2013 11:13 PM
    Edited by: user646034 on Feb 23, 2013 11:19 PM
    Edited by: user646034 on Feb 23, 2013 11:46 PM
    Edited by: user646034 on Feb 25, 2013 11:46 AM

    Hi
    The below explain without index and with index.
    /* MV_REFRESH (DEL) */ DELETE FROM "APPS"."BAL_PART                                                                                                                                                                                                                                                                                                                                                                                                                
    " SNA$ WHERE "C3" IN (SELECT /*+ NO_MERGE  */ * FROM (SELECT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    CHARTOROWID("MAS$"."M_ROW$$") RID$     FROM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    "GL"."MLOG$_GL_SETS_OF_BOOKS" "MAS$"   WHERE "MAS$".SNAPTIME$$ > :B_ST1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    ) AS OF SNAPSHOT(:B_SCN) MAS$)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    Plan hash value: 2704021294                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Id  | Operation            | Name                          | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   0 | DELETE STATEMENT     |                               |        |       |   339K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   1 |  DELETE              | BAL_PART                          |        |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   2 |   NESTED LOOPS       |                               |      1 |   168 |   339K  (1)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   3 |    SORT UNIQUE       |                               |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   4 |     TABLE ACCESS FULL| MLOG$_GL_SETS_OF_BOOKS        |      1 |   138 |     2   (0)| 00:02:31 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    |   5 |    INDEX RANGE SCAN  | C3BOOKS                       |    110M|  3164M|   339K  (0)|999:59:59 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    If i will not use the C3 index then the query will use the belolw plan, I guess this will also take same time or more time.
    |   0 | DELETE STATEMENT       |                               |        |       |  9743K(100)|          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    |   1 |  DELETE                | BAL_PART                          |       |            |          |                                                                                                                                                                                                                                                                                                                                                                                                     

  • 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

  • Error While Creating Materialized View

    Hello,
    I am getting error ORA-22818: subquery expressions not allowed here while creating materialized view. I am using Oracle9i Enterprise Edition Release 9.2.0.1.0. Below pasted is my SQL Script.
    Any help is highly appreciable.
    Thanks
    *********SQL************
    select distinct(id),NAME,(select count(GRADE) from employees where
    nationality like '%US%'and id=a.organization_id and grade=a.grade
    group by ID,GRADE) US,(select count(GRADE) from employees where
    nationality not like '%US%' and organization_id=a.organization_id and grade=a.grade
    group by ORGANIZATION_ID,GRADE) NON_US,grade from employees a
    where grade is not null
    group by GRADE,ID,name
    order by to_number(grade) desc

    Hi,
    This is a documented restriction on MVs. You cannot have a scalar express (i.e a select statement) in the select list.
    You can get round this by joining your select count(grade).. expression in as an inline view in your FROM clause. Or you can create a normal view without the scalar expression, create your MV as a select from this view, then re-define your view to contain the query you want.
    Hope that helps,
    Rod West

  • Error while creating Materialized View step 3 of 6 using wizard

    have oracle 9i Rel 1 on Windows 2000 server. Master Site has been setup. Database links are created at Materialized view site. But while creating Materialized View Group using wizard there is following error on step 3 of 6.
    Statement:----------------
    /*OracleOEM*/ SELECT 1 FROM SYS.dba_constraints@masterdbname WHERE OWNER='username' and table_name='tabname' AND constraint_type='P'
    Stack Trace:----------------
    ORA-00942: table or view does not exist.
    ORA-02063: preceding line from masterdbname.
    All parameters for replication are correct.
    Please help me early.
    Thanks

    Hello,
    In the masterdbname, logging as sys user, you must grant select permission on sys.dba_constraints view to mvadmin_dbname user (where dbname is the replicated database name).
    Regards,

  • Error while creating Materialized View step 3 of 6

    I have oracle 9i Rel 1 on Windows 2000 server. Master Site has been setup. Database links are created at Materialized view site. But while creating Materialized View Group there is following error on step 3 of 6.
    Statement:----------------
    /*OracleOEM*/ SELECT 1 FROM SYS.dba_constraints@masterdbname WHERE OWNER='username' and table_name='tabname' AND constraint_type='P'
    Stack Trace:----------------
    ORA-00942: table or view does not exist.
    ORA-02063: preceding line from masterdbname.
    All parameters for replication are correct.
    Please help me early.
    Thanks

    Hello,
    In the masterdbname, logging as sys user, you must grant select permission on sys.dba_constraints view to mvadmin_dbname user (where dbname is the replicated database name).
    Regards,

  • Error while creating Materialized View in AWM

    Hello,
    I am using Oracle 11g with Analytic WorkSpace Manager 11.1.0.6.0A
    I am trying to create materialized view on my Cube..
    The Cube has 5 Dimensions out of which Four are having two levels i.e.,
    TotalA-->DimensionA
    TotalB-->DimensionB...and so on
    And one time Dimension having 4 levels
    TotalTime-->YEAR-->QUARTER-->MONTH
    When i try to create the materialized view, i get an error saying that
    "Your metadata changes have been saved, with the following errors
    CREATE MATERIALIZED VIEW "ENT.CB$TIME_TIME_HIER"
    ORA-02267:column type incompatible with referenced column type"
    When i googled regarding this error, it says to change the datatype of the column..
    But which column's data type is to be changed..Please throw some light regarding this...
    Awaiting for reply..

    My query is as follows:
    SELECT
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type1' )then 1 else 0 end)) as Cumm_product1_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Mode1_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode1_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_CLRING_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode2_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_TRSFER_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode3_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode3' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode3_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode2' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode2_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_product1Mode1Type1_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Mode1_Type2_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Mode1_Total_Txn_Amount
    /* From dimension views and cube view */
    FROM CUSTOMER_ID_CUSTOMER_ID_HIE_VIEW b,
    TIME_TIME_HIER_VIEW j,
    product_product_HIER_VIEW k,
    MODE_MODE_HIER_VIEW l,
    TYPE_TYPE_HIER_VIEW m,
    CUBETEST_VIEW cd
    /* Create level filters */
    WHERE b.level_name = 'CUSTOMER_ID'
    AND b.LONG_DESCRIPTION='xyz'
    AND j.LEVEL_NAME='MONTH'
    AND j.END_DATE between to_date('2007-10-31','YYYY-MM-DD') and to_date('2007-10-31','YYYY-MM-DD')
    /* Join dimension views to cube view */
    AND b.DIM_KEY=cd.ACCOUNT_ID
    AND j.DIM_KEY=cd.TIME
    AND k.DIM_KEY=cd.product
    AND l.DIM_KEY=cd.MODE
    AND m.DIM_KEY=cd.TYPE
    ORDER BY j.end_date,
    k.level_name,
    l.level_name,
    m.level_name;

Maybe you are looking for

  • I set up two identities, the default & one more. How to get mail from the second one?

    I have two different e-mail addresses that I want to get mail from. So the main/default one worked just fine. So I went to options, account settings, identities and set up the second one. But this second one doesn't appear on the start page and still

  • Restting the number ranges

    Client Copy: Each time a client copy is made, material movement postings cannot be processed until several number ranges are reset and the user gets the message Express document “update was terminated”. These number ranges can be reset thru SNRO. But

  • Premiere Elements 8

    Today Adobe announced the release of Premiere Elements 8. For those interested in some of the new featuers in this exciting new release, I've created a new FAQ with a linked PDF of some screen shots and detailed discussions. http://forums.adobe.com/t

  • File conversion - Multiple recordsets

    Dear All I am trying to convert a file in the Sender File Adapter that has more than one recordsets but I cant find the solution. The adapter gives the option of recordset numbers but how can I define them? To make it simple my file conversion result

  • How use Jndi datasoure in Jserver?

    Hi, I want to deploy EJB to jserver. The EJB use JNDI jdbc2.0 datasource to access database. But there only are some sujects how to use JNDI jdbc datasoure in client application in oracle8i 8.1.6 jdbc 2.0 document, no in Jserver. Which one could tell