Create materialized view get ora-00998 error cause by subquery

hi all,
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
thx all

>
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
>
Well since the error is 'ORA-00998: must name this expression with a column alias' you might try naming your expressions with aliases
select a.dealer_no dealer_no,a.sk_period sk_period from DM_DIM_DEALER a

Similar Messages

  • 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.

  • Error creating materialized view log using DBlink

    Hi guys,
    I have 2 databases in diferent machines . (machine A and B)
    Machine A is my production database and I have a database link in machine B accessing Machine A
    CREATE MATERIALIZED VIEW vm_test
    BUILD IMMEDIATE
    REFRESH FAST ON commit as
    select * from test@A
    -- no problem in this first operation the materialized view was created sucessfully
    Now I need to create the LOG
    SQL> CREATE MATERIALIZED VIEW LOG ON test
    2 PCTFREE 5
    3 TABLESPACE prodemge_2006
    4 STORAGE (INITIAL 10K NEXT 10K);
    CREATE MATERIALIZED VIEW LOG ON test
    ERROR at line 1:
    ORA-02050: transaction 5.21.8771 rolled back, some remote DBs may be in-doubt
    ORA-02068: following severe error from A
    ORA-03113: end-of-file on communication channel
    What could be causing this error ?
    Thank you,
    Felipe

    ORA-02050 transaction string rolled back, some remote DBs may be in-doubt
    Cause: Network or remote failure during a two-phase commit.
    Action: Notify operations; remote databases will automatically re-sync when the failure is repaired.
    ORA-02068 following severe error from stringstring
    Cause: A severe error (disconnect, fatal Oracle error) was received from the indicated database link. See following error text.
    Action: Contact the remote system administrator.
    M.S.Taj

  • 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

  • Materialized view problem ORA-00904: "from$_subquery$_ error

    Hello everyone,
    I've created data warehouse star schema and I'm trying to set up materialized view. DBMS_MVIEW.EXPLAIN_MVIEW passes and also the select query passes and is executed with no problems but when I try to CREATE MATERIALIZED VIEW... then error ORA-00904: "from$_subquery$_003"."SERVICE_ID_2_2": invalid identifier pops-up. How does Oracle 9i (9.2.0.1.0) managed to do this ? How to make it to work ?
    This is the query, and the schema:
    CREATE MATERIALIZED VIEW analiza_profitabilnosti
    BUILD IMMEDIATE
    REFRESH FAST
    ON COMMIT
    AS
    select
    GROUPING_ID(t.y,t.q,t.m,t.w,t.d,s.service_type,s.service_id,c.customer_category) as g_id,
    t.y, t.q, t.m, t.w, t.d,
    s.service_type , s.service_id ,
    c.customer_category ,
    COUNT(*) as c_star,
    SUM(cost) cost, COUNT(cost) c_cost,
    SUM(number_of_units) number_of_units, COUNT(number_of_units) as c_number_of_units
    from fact f
    inner join timeline t on f.datum = t.datum
    inner join service s on f.service_id = s.service_id
    inner join customer_category c on f.customer_category=c.customer_category
    group by
    ROLLUP(t.y, t.q, t.m, t.w, t.d),
    ROLLUP(s.service_type, s.service_id),
    ROLLUP (c.customer_category)
    and the schema:
    FACT (
    DATUM DATE,
    HOST_ID NUMBER,
    SERVICE_ID NUMBER (5),
    CALLED_PREFIX_ID NUMBER (10),
    CUSTOMER_CATEGORY NUMBER,
    TRAFIC_PERIOD_ID NUMBER (5),
    CALL_DURATION NUMBER,
    COST NUMBER,
    NUMBER_OF_UNITS NUMBER,
    NUMBER_OF_CALLS NUMBER)
    TIMELINE (
    Y VARCHAR2 (5),
    Q VARCHAR2 (5),
    M VARCHAR2 (5),
    W VARCHAR2 (5),
    D VARCHAR2 (5),
    DATUM DATE NOT NULL)
    SERVICE (
    SERVICE_ID NUMBER (5) NOT NULL,
    SERVICE_CODE VARCHAR2 (15) NOT NULL,
    SERVICE_NAME VARCHAR2 (63),
    SERVICE_TYPE NUMBER (5),
    SERVICE_TYPE_CODE VARCHAR2 (4) NOT NULL,
    S_ID NUMBER (5))
    CUSTOMER_CATEGORY (
    CUSTOMER_CATEGORY_NAME VARCHAR2 (65) NOT NULL,
    CUSTOMER_CATEGORY NUMBER NOT NULL)
    Thanks,
    Igor

    Yes, thank you. I suspected that version is problem, and patch 9.2.0.6 helped. It works under 9.2.0.6

  • Create materialized view across dblink gets ORA-980?

    Hi!
    Oracle 9.2.0.5. Creating a materialized view on on a synonym that points to a table across a dblink. I am getting a ORA-980 error that synonym translation is no longer valid. However selecting against the same synonym returns the rows or the count, etc. What am I missing here?
    This is the code that is being run:
    create materialized view gxp_sc_item as select * from sc_item_db2;
    Hints, tips, ideas, etc. gratefully accepted!
    Dave Venus

    Hi!
    Thanks for the reply!
    Yes that is a solution, however why does the synonym work for everything else? I can't find anything that says this should not work.
    Yes running 9.2.0.8 would be my first choice. The application vendor does not certify anything higher than 9.2.0.5.
    Thanks!
    Dave Venus

  • Error: ORA-00905:Missing keyword while creating Materialized view

    Hi Gurus,
    I am trying to create a materialized view as :
    1 CREATE MATERIALIZED VIEW AMREG.ClientData
    2 TABLESPACE AMREG_DATA
    3 COMPRESS
    4 PARALLEL
    5 NOLOGGING
    6 BUILD IMMEDIATE
    7 REFRESH COMPLETE
    8 ON DEMAND
    9 DISABLE QUERY REWRITE
    10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    11 AS
    12 SELECT
    13 CHILD.CLIENT_SGK "Child SGK",
    14 CHILD.CLIENT_NAME "Child Name",
    15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
    16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
    17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
    18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
    19 HIER.LVL_FROM_ANCESTOR ,
    20 FROM [email protected] CHILD,
    21 [email protected] HIER,
    22 [email protected] ULTIMATE
    23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
    24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
    SQL> /
    REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
    ERROR at line 10:
    ORA-00905: missing keyword
    DBLink name is : DNYCPH60.WORLD
    Please guide me on this and help to resolve the issue.

    I provided the answer over at the duplicate post ...
    ORA-00905: missing keyword error while creating a materialised view
    Please, please, please ... please do not duplicate posts. Pick one. If you don't get an answer in a reasonable time - close it (edit the title) and THEN open in a different forum.

  • Create Materialized view Error ORA-22818

    Hi,
    I am creating a materialized view based on a complex query with inline queries, below is a simplified version of the query:
    CREATE MATERIALIZED VIEW CM_FA_PEND_mvu
    TABLESPACE CISTS_TH
    BUILD IMMEDIATE
    REFRESH COMPLETE
    ENABLE QUERY REWRITE
    AS
    SELECT/*+ index (a,XT094S3) index (b,XT232S1) index (c, XM143P0) index (d, XM185S1)*/
    a .fa_id,
    a.fa_type_cd,
    a.fa_status_flg,
    a.disp_grp_cd,
    (SELECT dl.descr
    FROM ci_disp_grp_l dl
    WHERE dl.disp_grp_cd = a.disp_grp_cd AND dl.language_cd = 'ENG')
    disp_grp_cd_descr
    FROM ci_fa a,
    ci_sp_mtr_hist b,
    ci_mtr_config c,
    ci_reg d,
    ci_fapr_faty e
    WHERE a.fa_type_cd = e.fa_type_cd
    AND a.sp_id = b.sp_id(+)
    AND b.mtr_config_id = c.mtr_config_id(+)
    AND c.mtr_id = d.mtr_id(+)
    AND a.fa_status_flg = 'P'
    AND e.fa_type_prof_cd = 'METERED'
    AND ( (b.removal_dttm IS NULL))
    I am getting error "ORA-22818: subquery expressions not allowed here". the problem is in columns "disp_grp_cd_descr" (when I remove this column from the query, the MView is created successfully)
    Is using inline queries as columns a limitation on creating materialized view?
    Is there a workaround ?
    Thanks
    AK

    No version and no exception ... the full text is necessary the number alone insufficient ... to help you much other than recommend you read this:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm#DWHSG8195
    where it says:
    "The SELECT clause in the materialized view creation statement defines the data that the materialized view is to contain. Only a few restrictions limit what can be specified. Any number of tables can be joined together. Besides tables, other elements such as views, inline views (subqueries in the FROM clause of a SELECT statement), subqueries, and materialized views can all be joined or referenced in the SELECT clause. You cannot, however, define a materialized view with a subquery in the SELECT list of the defining query. You can, however, include subqueries elsewhere in the defining query, such as in the WHERE clause."
    Something you could have found in a second or two in the docs at http://tahiti.oracle.com by searching for "Materialized Views Restrictions"
    But without your version and the actual error message this may not apply.

  • Materialized view fast refresh ...getting ORA-22992: error

    Hi All,
    Oracle version 11.1.0.7
    While creating a materialized view(Fast refresh) on remote tables ... i am getting the ORA-22992: cannot use LOB locators selected from remote tables ... error.
    but the actual scenario is... i am not selecting any of the BLOB/LOB columns from the remote tables. I did n't include them in my materialized query.
    I am able to refresh it complete but couldn't refresh it fast. Here i want to mention other thing... when ever i have records in Mat view log(Base table has a blob cloumns in it)
    i am getting the above error. when no record in the Mat view log(i.e on BLOB base table) .. i can able to refresh it as FAST.
    MV_CAPABILITIES table tells that ...My Mat view is able to refresh it FAST.I don't know howw to approach to solve this issue.could some one tell me the approach..to solve it?
    Here is the sample code ....this is what i have done so fat
    session 1 (REMOTE_ONE)
    I have created synonyms for the remote tables on current schema. That's why i didn't include @DBLINK.
    create table RT_A ( col1_A varchar2(20), col2_A BLOB,COL3_A NUMBER);
    create a table RT_B (COl1_B varchar2(20), col2_B BLOB, COL3_B NUMBER);
    create a table RT_C (COL1_C varchar2(20), col2_C VARCHAR2,COL3_C NUMBER);
    create  MATERIALIZED VIEW LOG ON RT_A 
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_B
    WITH  ROWID EXCLUDING NEW VALUES;
    create  MATERIALIZED VIEW LOG ON RT_C 
    WITH  ROWID EXCLUDING NEW VALUES;
    grant select on RT_A to CUURRENT_ONE with grant option;
    grant select on RT_B to CUURRENT_ONE with grant option;
    grant select on RT_C to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_A to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_B to CUURRENT_ONE with grant option;
    grant select on MLOG$_RT_C to CUURRENT_ONE with grant option;Session 2 (CUURRENT_ONE)
    create materialized view ABC_MV
    BUILD IMMEDIATE REFRESH FORCE ON DEMAND START WITH SYSDATE NEXT SYSDATE+1
    AS
    select A.ROWID AS A_ROWID,
    B.ROWID as B_ROWID,
    C.ROWID AS C_ROWID,
    A.COL1_A,
    B.col1_B,
    c.col1_c
    from RT_A, RT_B,RT_C
    where COL3_A = COL3_B(+)
    and COL3_B = COL3_C(+)Appreciate your help.
    Thanks,
    Mike

    Thanks for the reply
    In that he/she is selecting the LOB column from the remote database(master site).
    I am just referencing the table which has BLOB column in it.I am not referencing any LOB column in my select(Mat view) query...
    is there anything i need to check..?
    Regards,
    Mike

  • Error on "CREATE MATERIALIZED VIEW"

    I tried to create this materialized view:
    CREATE MATERIALIZED VIEW mv_cost_est
    BUILD IMMEDIATE
    REFRESH complete
    START WITH to_date(sysdate,'dd/mm/yyyy hh24:mi:ss')
    NEXT sysdate + 60/86400
    disable QUERY REWRITE
    AS
    SELECT
    efm_contratti.contratto_id,
    efm_commesse.dp_id,
    x.wr_id,
    (select max(cost_class_attiva) from efm_cost_cat_passivo_attivo
    where x.cost_class_id = efm_cost_cat_passivo_attivo.cost_class_passiva
    and x.cost_cat_id = efm_cost_cat_passivo_attivo.cost_cat_passiva
    ) AS classe_costo,
    (select max(cost_cat_attiva) from efm_cost_cat_passivo_attivo
    where x.cost_cat_id = efm_cost_cat_passivo_attivo.cost_cat_passiva
    and x.cost_class_id = efm_cost_cat_passivo_attivo.cost_class_passiva) as cat_costo,
    x.cost_est_total,
    (SELECT CASE
    WHEN status IN ('I','SA') and ( (TO_DATE(LAST_DAY(SYSDATE)) > wr.date_est_start) or wr.pct_complete > 0 ) THEN
    (case
    when wr.pct_complete > 0 then
    (wr.cost_est_total * wr.pct_complete /100 * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end = wr.date_est_start and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE))) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end > TO_DATE(LAST_DAY(SYSDATE)) ) then
    (wr.cost_est_total * ((TO_DATE(LAST_DAY(SYSDATE)) - wr.date_est_start) / (wr.date_est_end - wr.date_est_start) ) * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) ) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end = TO_DATE(LAST_DAY(SYSDATE))) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    END)
    WHEN status = 'Com' THEN cost_est_total * (1 + pct_ricarico/100)
    WHEN status = 'CON' THEN cost_total * (1 + pct_ricarico/100)
    WHEN status = 'BEN' THEN cost_total * (1 + pct_ricarico/100)
    else
    0
    end
    from wr where wr.wr_id=x.wr_id) as IMPORTO1,
    'EUR',
    efm_commesse.ac_id,
    project.project_id,
    project.project_type,
    x.status,
    x.cost_est_total,
    x.cost_total,
    x.pct_complete,
    (SELECT CASE
    WHEN status IN ('I','SA') THEN
    (case
    when wr.pct_complete = 0 and wr.date_est_start = wr.date_est_end and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete = 0 and wr.date_est_end > TO_DATE(LAST_DAY(SYSDATE)) then
    round (((TO_DATE(LAST_DAY(SYSDATE)) - wr.date_est_start) / (wr.date_est_end - wr.date_est_start)*100), 2)
    when wr.pct_complete = 0 and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete = 0 and wr.date_est_end = TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete > 0 then
    wr.pct_complete
    END)
    WHEN status = 'Com' THEN 100
    WHEN status = 'CON' THEN 100
    WHEN status = 'BEN' THEN 100
    else
    0
    end
    from wr where wr.wr_id=x.wr_id) as SAL_CALCOLATO,
    x.pct_ricarico,
    x.commessa_id,
    x.cost_class_id,
    x.cost_cat_id
    FROM
    wr x, cf, efm_contratti, efm_commesse, project,wrbennonfattura
    WHERE x.cf_id=cf.cf_id
    AND x.commessa_id=efm_commesse.commessa_id
    AND x.contratto_id=efm_contratti.contratto_id
    AND x.project_id=project.project_id
    AND efm_commesse.status not in ('Closed')
    and x.wr_id=wrbennonfattura.wr_id
    and project.project_type in ('03','10')
    AND x.cost_class_id is not null
    but I get this error:
    ORA-22818: subquery expressions not allowed here
    How can I rewrite my query to avoid this error?
    Thanks in advance!

    I'm sorry, the solution I gave above may not be correct. Try http://download.oracle.com/docs/cd/B19306_01/server.102/b14200.pdf - section 15-6. And the solution may be:
    ORA-22818: subquery expressions not allowed here
    Cause: An attempt was made to use a subquery expression where these are not supported.
    Action: Rewrite the statement without the subquery expression.

  • Create materialized view, ORA-00942

    I would like to create a materialized view on user scott@orcl for user colinsuper. User scott@orcl have
    "CREATE ANY MATERIALIZED VIEW" permissions. Why does I get an ORA-00942 error?
    Remote-Database: remote_orcl.world
    Remote-Database-User: lindasuper
    Remote-Database-Table: cars
    scott@orcl>create synonym cars for lindasuper.cars@remote_orcl.world
    2 /
    Synonym created.
    scott@orcl>select car_no cno, car_bez cbez from cars
      2  where rownum <= 1;
    cno   cbez
    3     32-mxl
    scott@orcl
    scott@orcl
    scott@orcl>CREATE MATERIALIZED VIEW colinsuper.CARS_MV
      2    TABLESPACE my_tablespace
      3    BUILD IMMEDIATE
      4    USING INDEX TABLESPACE my_idx
      5    REFRESH
      6       START WITH sysdate
      7       NEXT ROUND(SYSDATE)+5/24 
      8       WITH PRIMARY KEY
      9    ENABLE QUERY REWRITE
    10    AS
    11    SELECT car_no cno
    12           car_bez cbez
    13    FROM cars
    14  /
    CREATE MATERIALIZED VIEW colinsuper.CARS_MV
    FEHLER in Zeile 1:
    ORA-00942: Tabelle or View does not exist
    scott@orcl>
    scott@orcl>
    scott@orcl>When I am creating the materialized view without the user colinsuper, materialized view
    is creating without problems.
    scott@orcl>CREATE MATERIALIZED VIEW CARS_MV
      2    TABLESPACE my_tablespace
      3    BUILD IMMEDIATE
      4    USING INDEX TABLESPACE my_idx
      5    REFRESH
      6       START WITH sysdate
      7       NEXT ROUND(SYSDATE)+5/24 
      8       WITH PRIMARY KEY
      9    ENABLE QUERY REWRITE
    10    AS
    11    SELECT car_no cno
    12           car_bez cbez
    13    FROM cars
    14  /
    Materialized View wurde erstellt.
    scott@orcl>
    scott@orcl>I think there is somthing wrong with the permissions of colinsuper!?

    Is this colinsuper a user in the remote database.
    ORA-00942:     table or view does not exist
    Cause:     
    The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.
    Action:     
    Check each of the following:
    the spelling of the table or view name.
    that a view is not specified where a table is required.
    that an existing table or view name exists.
    Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table.
    Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted.

  • Error while creating materialized view which using database link

    Helo!
    I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
    Details:
    1. On destination database I create a database link:
    CREATE DATABASE LINK SDATABASE
    CONNECT TO MYUSER
    IDENTIFIED BY MYUSERPASS
    USING 'ORCL';
    => Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
    2. On source database I create MATERIALIZED VIEW LOG:
    CREATE MATERIALIZED VIEW LOG
    ON TABLE1
    WITH PRIMARY KEY
    INCLUDING NEW VALUES;
    3. Now, when I want to create MATERIALIZED VIEW on destination database:
    CREATE MATERIALIZED VIEW TABLE1
    REFRESH FAST
    START WITH SYSDATE
    NEXT SYSDATE + 1/1440
    WITH PRIMARY KEY
    AS SELECT * FROM TABLE1@SDATABASE;
    ...I get error "ORA-00942: table or view does not exist"!
    How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
    Thanks,
    Voranc

    And, I'm using Oracle 10g.
    Voranc

  • 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 occured while creating MATERIALIZED VIEW

    I created as below:
    CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_HDR
    WITH ROWID, SEQUENCE, PRIMARY KEY;
    CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_DTL
    WITH ROWID, SEQUENCE;
    REATE MATERIALIZED VIEW F_GL_SMRY_MVW
    PARALLEL
    BUILD IMMEDIATE
    REFRESH FAST ON COMMIT AS
    SELECT * FROM
    SELECT
    F_CV_HDR.ROWID "HDR_ID",
    CAST(NULL AS ROWID) "DTL_ID",
    cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
    cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
    cah_cv_nmbr gsv_dcmnt_nmbr,
    cah_lcm_lctn_code dsv_lcm_lctn_code,
    cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
    cah_cv_date gsv_dcmnt_date,
    'G' gsv_sub_code_type,
    DECODE(cah_dsm_dcmnt_type,'CPV',0,'CRV',cah_net_amnt) gsv_amnt_dbtd,
    DECODE(cah_dsm_dcmnt_type,'CPV','C','CRV','D') gsv_dr_cr_indctr,
    cah_net_amnt gsv_amnt,
    DECODE(cah_dsm_dcmnt_type,'CPV',cah_net_amnt,'CRV',0) gsv_amnt_crdtd,
    cah_asm_sbldgr_code gsv_sub_code,
    CAH_RMRKS GSV_RMRKS,
    CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TYPE,
    CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TR_CODE,
    CAST(NULL AS NUMBER(10)) GSV_CRS_RFRNCE_NMBR,
    CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
    CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
    CAST(NULL AS NUMBER(13,2)) GSV_FRGN_CRNCY_AMNT,
    CAST(NULL AS DATE) GSV_DATE_FROM,
    CAST(NULL AS DATE) GSV_DATE_TO,
    CAST(NULL AS NUMBER(7)) GSV_RJH_NMBR,
    CAST(NULL AS VARCHAR2(3)) GSV_PJC_SRS,
    CAST(NULL AS NUMBER(7)) GSV_PJC_NMBR,
    CAST(NULL AS NUMBER(3)) GSV_PJC_EQPTMNT_SRL,
    CAST(NULL AS VARCHAR2(5))GSV_PJC_EXPNSE_HEAD_CODE,
    CAST(NULL AS VARCHAR2(3)) gsv_dpm_dprtmnt_code,
    cah_asm_amm_main_code gsv_amm_main_code,
    CAH_LCM_LCTN_CODE_BOOK GSV_LCM_LCTN_CODE_BOOK,
    CAST(NULL AS NUMBER) gsv_dr_cr_advce_srl,
    0 gsv_dcmnt_srl_nmbr,
    cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
    cah_trnsctnr_code gsv_trnsctnr_code,
    0 gsv_net_tds_amnt,
    to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
    to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
    cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
    CAH_SRCE_INDCTR GSV_SRCE_INDCTR,
    CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
    CAST(NULL AS DATE) gsv_bill_date,
    cah_pay_rcve_name gsv_pay_rcve_name
    FROM f_cv_hdr
    WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
    AND cah_avlble_indctr = 'Y'
    UNION ALL
    SELECT
    F_CV_HDR.ROWID "HDR_ID",
    f_cv_dtl.ROWID "DTL_ID",
    cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
    cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
    cah_cv_nmbr gsv_dcmnt_nmbr,
    cah_lcm_lctn_code dsv_lcm_lctn_code,
    cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
    cah_cv_date gsv_dcmnt_date,
    cad_sub_code_type gsv_sub_code_type,
    DECODE(cad_dr_cr_indctr, 'C',0,'D',cad_amnt) gsv_amnt_dbtd,
    cad_dr_cr_indctr gsv_dr_cr_indctr,
    cad_amnt gsv_amnt,
    DECODE(cad_dr_cr_indctr, 'D',0,'C',cad_amnt) gsv_amnt_crdtd,
    cad_sub_code gsv_sub_code,
    cad_rmrks gsv_rmrks,
    cad_crs_rfrnce_type gsv_crs_rfrnce_type,
    cad_crs_rfrnce_tr_code gsv_crs_rfrnce_tr_code,
    CAD_CRS_RFRNCE_NMBR GSV_CRS_RFRNCE_NMBR,
    CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
    CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
    CAST(NULL AS NUMBER(13,2)) gsv_frgn_crncy_amnt,
    cad_date_from gsv_date_from,
    cad_date_to gsv_date_to,
    cad_rjh_nmbr gsv_rjh_nmbr,
    cad_pjc_srs gsv_pjc_srs,
    cad_pjc_nmbr gsv_pjc_nmbr,
    cad_pjc_eqpmnt_srl gsv_pjc_eqptmnt_srl,
    cad_pjc_expnse_head_code gsv_pjc_expnse_head_code,
    cad_dpm_dprtmnt_code gsv_dpm_dprtmnt_code,
    cad_amm_main_code gsv_amm_main_code,
    cah_lcm_lctn_code_book gsv_lcm_lctn_code_book,
    cad_dr_cr_advce_srl gsv_dr_cr_advce_srl,
    cad_cv_srl_nmbr gsv_dcmnt_srl_nmbr,
    cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
    cah_trnsctnr_code gsv_trnsctnr_code,
    0 gsv_net_tds_amnt,
    to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
    to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
    cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
    cah_srce_indctr gsv_srce_indctr,
    CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
    CAST(NULL AS DATE) GSV_BILL_DATE,
    cah_pay_rcve_name gsv_pay_rcve_name
    FROM f_cv_hdr,
    F_CV_DTL
    WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
    AND cah_avlble_indctr = 'Y'
    AND cah_lcm_lctn_code = cad_cah_lcm_lctn_code
    AND CAH_DSM_DCMNT_TYPE = CAD_CAH_DSM_DCMNT_TYPE
    AND cah_cv_tmpry_nmbr = cad_cah_cv_tmpry_nmbr);
    Giving below 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.
    ==================================================

    *Action: Specify only valid options.                                                                                                                                                                                                                           

  • Error in creating materialized view

    Hi all,
    I am trying to create the following materialized view, but throwing me the error message below
    CREATE MATERIALIZED VIEW "MVIW"."XXFA_R051_SHT2_AMV"
    (PARTITION BY LIST (PERIOD_YEAR)
    PARTITION YEAR2006 VALUES LESS ('2006'),
    PARTITION YEAR2007 VALUES LESS ('2007'),
    PARTITION YEAR2007 VALUES LESS ('2008'))
    TABLESPACE "MVIEW"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH FORCE ON DEMAND
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS (SELECT * FROM XXFA_R051_SHT2_MV);
    SQL Error: ORA-00907: missing right parenthesis
    00907. 00000 - "missing right parenthesis"
    *Cause:   
    *Action:
    Any pointers would be appreciated
    Thanks
    VR

    What is it your are actually trying to do?
    On one hand you say:
    PARTITION BY LIST (PERIOD_YEAR)
    Then you proceed to use the syntax for range partitioning:
    VALUES LESS ('2006'),
    Look up the correct syntax at http://tahiti.oracle.com or the demos in Morgan's Library at www.psoug.org.

Maybe you are looking for

  • App Downloads to more than 1 playbook

    how do I purchase an app for one of my playbooks but download to all three I own.  Each Playbook is bridged to three different phones.  All phones are connected to one wireless billing account

  • ASA 5505 vpn/OWA issue

    I have a client that is running Win2003 Server R2 with Exchange Server 2003. OWA was setup and clients could connect to their exchange mailbox from the internet with no problems. We recently configured vpn on the ASA 5505 and now no-one can connect t

  • Can you please help me create this graph?

    I have spent over 10 hours trying to create something similar to this graph in Numbers and Pages. Pages and Numbers forces me to use automated Min and Max axes in order to display evenly distributed numbers. Because of the wide difference between num

  • BI IP - Upload flat file - "requested resource not found" when typing URL

    Hi, we tried to implement the "upload flat file" functionality (blog Marc Bernard). We followed the different steps and included the bug fixes as well. When we want to launch the URL in an internet explorer session we get message "requested resource

  • MBA - Video display & resolution concerns

    Hello! My parents currently own an aging, first-generation white MacBook. I want to help them migrate to a newer laptop, possibly a MacBook Air aka MBA), within the next several months. I used to own a 15-inch MacBook Pro (2007 vintage, IIRC) but it