Query rewrite clause getting error

Hi all;
I did not complete Query rewrite clause (M.view) , when trying to enable i am getting error
and i have asked this question " https://forums.oracle.com/forums/thread.jspa?threadID=2543789 "
Question wrongly posted under data communication model. - So this is not a duplicate thread.
please reply me what was missing here ?
SQL> alter system set query_rewrite_enabled='TRUE' scope=SPFILE;
SQL> grant query rewrite to ****;
Grant succeeded.
conn xxx/xxxx@xxxxxx
1. SQL> ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS/
Session altered.
2. SQL> alter session set query_rewrite_enabled=true;
Session altered.
3. SQL> execute dbms_stats.gather_table_stats('rose', 'mv1');
PL/SQL procedure successfully completed.
4. SQL> exec dbms_mview.explain_rewrite('select * from sales','MV1');
BEGIN dbms_mview.explain_rewrite('select from sales','MV1'); END;*
*ERROR at line 1:
ORA-30380: REWRITE_TABLE does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 3085
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 3206
ORA-06512: at line 1Thanks in advance ..

Expain plan before utlxrw.sql execution SQL> select count(*), sum(quan_sold), sum(amt_sold) from sales;
COUNT(*) SUM(QUAN_SOLD) SUM(AMT_SOLD)
6000000 12000000 720480000
Elapsed: 00:00:00.03
Execution Plan
Plan hash value: 2958490228 | Id | Operation      | Name | Rows | Bytes | Cost (CPU)| Time
0 | SELECT STATEMENT | | 1 | *40* | 3 (0) | 00:00 :01
1 | MAT_VIEW REWRITE ACCESS FULL | MV1 | 1 | *40* | 3 (0) | 00:00 :01
SQL> @$ORACLE_HOME/rdbms/admin/utlxrw.sql;
Table created.
SQL> exec dbms_mview.explain_rewrite('select * from sales','MV1');
PL/SQL procedure successfully completed.
SQL> select count(*), sum(quan_sold), sum(amt_sold) from sales;COUNT(*) SUM(QUAN_SOLD) SUM(AMT_SOLD)
6000000 12000000 720480000
Execution Plan
Plan hash value: 2958490228
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | *11* | 3 (0) | 00:00:01 |
| 1 | MAT_VIEW REWRITE ACCESS FULL | MV1 | 1 | *11* | 3 (0) | 00:00:01 |
but i do NOT find any difference after enabling Query rewrite clause .. please clarify this ..
bytes only changed.

Similar Messages

  • How to use : bind character in DB adapter Select Query SOA11g. Getting Error code :17003 .java.sql.SQLException: Invalid column index error

    Hi All,
    The Actual query to perform is below.
    SELECT name,number from emp  WHERE CASE WHEN :1='T' AND term_date IS Not NULL THEN 1 WHEN :1='A' AND term_date IS NULL THEN 1 WHEN :1='ALL' THEN 1 ELSE  1 END = 1;
    I have tried in DB adapter like below as a parameter for :1 as #vInputParam
    SELECT name,number from emp  WHERE CASE WHEN #vInputParam='T' AND term_date IS Not NULL THEN 1 WHEN #vInputParam='A' AND term_date IS NULL THEN 1 WHEN #vInputParam='ALL' THEN 1 ELSE  1 END = 1;
    Getting Error code :17003 .java.sql.SQLException: Invalid column index error.
    Please suggest me on using ':' bind character in DB adapter Select Query SOA11g.
    Can someone help me on this please?
    Thanks,
    Hari

    Hi,
    Could you please make sure your binding style(Oracle Positional,Oracle named..etc) of the Seeded VO and Custom Vo are same.
    This is the option you will get when you are extending your vo. So make sure that both are same.
    You can refer the below link too
    VO extension leads to "Invalid column index" exception
    Thanks
    Bharat

  • Query rewrite complains about ragged hierarchy when it does not exist

    Hi -
    I have a customer dimension with only one level. The lowest level of detai.
    When I enable the query rewrite I get an error (see below) about ragged or skipped level hierarchy in my customer dimension. I am trying to figure out what the issue is so I created a one level customer hierarchy (lowest level) and I still get the error.
    I do not understand how I can have a skipped/ragged hierarchy when my dimension is at the lowest level.
    I am using the lastest versions of AWM and 11G.
    Thanks in advance for any help you can provide,
    Frank
    Invalid Metadata Objects:
    Invalid Object "MYTEST.CUST_SALES": "XOQ-01957: The cube has REWRITE MVs and also contains either a ragged or skip-level hierarchy. The hierarchy is "MYTEST.CUST_DIM.STANDARD"."
    Edited by: bmwrider on Oct 16, 2009 9:01 AM

    Hi there,
    See this:- Error when trying to enable cube  MV query rewrite
    Thanks,
    Stuart Bunby
    OLAP Blog: http://oracleOLAP.blogspot.com
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    OLAP on OTN: http://www.oracle.com/technology/products/bi/olap/index.html
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Can someone  see why im getting error in this query ?

    I had 2 queries , instead of using left join i put them together. Now i get error , can someone just take a look to see if syntax wrong somewhere ?
    select * from
    select i.ips,
    a.ips,
    a.question_type,
    sum(a.score) score,
    p.project_name,
    p.project_segment,p.location,p.project_exec_model,
    p.project_exec_model||' - '||p.project_config pmodel,
    one.score schedule,two.score cost,three.score execution,four.score commercial,
    nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0) as total,
    (select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips) prev_score,
    (select max(createdt) from tbl_risk_answer where (ips,sample_num) in
    (select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips) last_dt
    from
    (select v.project_id,v.ips,v.sample_num,v.question_id,v.header_desc,v.section_area,v.score,
    decode(bi_recurse(q.active_question,1,2),2,'OTR','-')||decode(bi_recurse(q.active_question,1,1),1,'ITO','-') question_type
    from VW_RISK_SCORE v left join tbl_risk_question q on v.question_id=q.question_id
    where (v.project_id,v.sample_num) in
    (select project_id,max(sample_num) sample_num from VW_RISK_SCORE group by project_id)
    ) a,
    (select distinct ips from VW_RISK_SCORE) i,
    (select ips, sum(score) score from VW_RISK_SCORE where section_area=1 group by ips) one,
    (select ips, sum(score) score from VW_RISK_SCORE where section_area=2 group by ips) two,
    (select ips, sum(score) score from VW_RISK_SCORE where section_area=3 group by ips) three,
    (select ips, sum(score) score from VW_RISK_SCORE where section_area=4 group by ips) four,
    tbl_risk_project p
    where i.ips=one.ips(+) and i.ips=two.ips(+) and i.ips=three.ips(+) and i.ips=four.ips(+) and ito on scores.ips=ito.ips
    and i.ips=p.ips and  a.question_type='-ITO' group by  i.ips,a.ips, a.question_type, p.project_name, p.project_segment, p.location, p.project_exec_model, p.project_exec_model||' - '||p.project_config, one.score, two.score, three.score, four.score, nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0), (select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips), (select max(createdt) from tbl_risk_answer where (ips,sample_num) in
    (select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips)
    ) scores and here is error I get.
    ORA-00604: error occurred at recursive SQL level 1
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 12
    ORA-00920: invalid relational operator
    00604. 00000 - "error occurred at recursive SQL level %s"
    *Cause:    An error occurred while processing a recursive SQL statement
    (a statement applying to internal dictionary tables).
    *Action:   If the situation described in the next error on the stack
    can be corrected, do so; otherwise contact Oracle Support.
    Error at Line: 30 Column: 4

    You would move them to the from-clause, just like one, two, three and four.
    Something like:
    untested for obvious reasons
    select *
      from (select i.ips,
                   a.ips,
                   a.question_type,
                   sum(a.score) score,
                   p.project_name,
                   p.project_segment,
                   p.location,
                   p.project_exec_model,
                   p.project_exec_model || ' - ' || p.project_config pmodel,
                   one.score schedule,
                   two.score cost,
                   three.score execution,
                   four.score commercial,
                   nvl(one.score, 0) + nvl(two.score, 0) + nvl(three.score, 0) +
                   nvl(four.score, 0) as total,
                   (select sum(prev_score) prev
                      from xt_risk_past2
                     where ips = i.ips) prev_score,
                   (select max(createdt)
                      from tbl_risk_answer
                     where (ips, sample_num) in
                           (select ips, max(sample_num)
                              from vw_risk_score
                             group by ips)
                       and ips = i.ips) last_dt
              from (select v.project_id,
                           v.ips,
                           v.sample_num,
                           v.question_id,
                           v.header_desc,
                           v.section_area,
                           v.score,
                           decode(bi_recurse(q.active_question, 1, 2),
                                  2,
                                  'OTR',
                                  '-') ||
                           decode(bi_recurse(q.active_question, 1, 1),
                                  1,
                                  'ITO',
                                  '-') question_type
                      from vw_risk_score v
                      left join tbl_risk_question q
                        on v.question_id = q.question_id
                     where (v.project_id, v.sample_num) in
                           (select project_id, max(sample_num) sample_num
                              from vw_risk_score
                             group by project_id)) a,
                   (select distinct ips from vw_risk_score) i,
                   (select ips, sum(score) score
                      from vw_risk_score
                     where section_area = 1
                     group by ips) one,
                   (select ips, sum(score) score
                      from vw_risk_score
                     where section_area = 2
                     group by ips) two,
                   (select ips, sum(score) score
                      from vw_risk_score
                     where section_area = 3
                     group by ips) three,
                   (select ips, sum(score) score
                      from vw_risk_score
                     where section_area = 4
                     group by ips) four,
                   tbl_risk_project p
                   -- moved part I
                   (select ips,
                           sum(prev_score) prev
                      from xt_risk_past2
                     where ips = i.ips) five --or whatever
                   -- moved part II
                  (select ips,
                     max(createdt) maxcreatedt
                    from tbl_risk_answer
                   where (ips, sample_num) in  (select ips, max(sample_num)
                                                  from vw_risk_score
                                              group by ips)
                   group by ips) six -- or whatever              
             where i.ips = one.ips(+)
               and i.ips = two.ips(+)
               and i.ips = three.ips(+)
               and i.ips = four.ips(+)
               and i.ips = five.ips -- outerjoin if needed
               and i.ips = five.ips -- outerjoin if needed
               and ito on scores.ips = ito.ips
               and i.ips = p.ips
               and a.question_type = '-ITO'
             group by i.ips,
                      a.ips,
                      a.question_type,
                      p.project_name,
                      p.project_segment,
                      p.location,
                      p.project_exec_model,
                      p.project_exec_model || ' - ' || p.project_config,
                      one.score,
                      two.score,
                      three.score,
                      four.score,
                      nvl(one.score, 0) + nvl(two.score, 0) +
                      nvl(three.score, 0) + nvl(four.score, 0),
                      five.prev,
                      six.maxcreatedt
           ) scoresI wonder how all this is going to perform by the way....all those scalar subqueries and outer joins are expensive....
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1594885400346999596
    Read up on Subquery Factoring/WITH-clause, and try to rewrite parts of your query.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4423923392083

  • Getting Error While Uploading Clause Document in SAP Sourcing 9.0

    Hi,
    --------------------system description--------------
    SAP Sourcing 9.0
    SAP NW7.31 AS JAVA
    IBM DB2 9.7
    I am getting error while executing clause document.
    ----------------------Error Description---------------
    Login with buyer link into the system-> it has all authorizations
    then Goto -> Contract Management -> Clause Library -> Clause list -> Click on New button -> Click on Add button -> Browse Document
    it is showing POPUP with Error that "There is a problem with the Contract Generation web service Contact your system administrator"
    Thanks and Regards,
    Murtaza Najmi

    Hi Gary,
    it is standalone system i have, everything i have installed on one server.
    i have already checked with restarting IIS server, and i can see word service while running url in contractgen.serviceurl, word service is running fine on browser but when i upload the document a popup window comes with error as i have shown above in my query
    Thanks once again Gary for replying
    Thanks and Regards,
    Murtaza Najmi

  • Error while enabling query rewrite on cube

    Hi
    Trying to enable query rewrite option for OLAP cube throws below error message :
    Your metadata changes have been saved, with the following errors
    Invalid Metadata Objects:
    Invalid Object "FUSION.FLINE_STATUS_CUBE2": "CREATE MATERIALIZED VIEW "FUSION"."CB$FLINE_STATUS_CUBE2"
    ORGANIZATION CUBE ON FUSION.DOO_STATUS (
    FACT "FLINE_STATUS_CUBE2_STORED"("FLINE_STATUS_CUBE2_MEASURE_DIM" 'SYS_COUNT') IS "SYS_COUNT",
    FACT "FLINE_STATUS_CUBE2_STORED"("FLINE_STATUS_CUBE2_MEASURE_DIM" 'TOTAL_QUANTITY') IS "TOTAL_QUANTITY",
    FACT "FLINE_STATUS_CUBE2_STORED"("FLINE_STATUS_CUBE2_MEASURE_DIM" 'TOTAL_PRICE') IS "TOTAL_PRICE",
    DIMENSION "WAREHOUSE1" IS "WAREHOUSE1" .............................................
    ORA-30353: expression not supported for query rewrite
    There are no issues with loading/viewing data from cube.
    Any pointers on what could be going wrong herel.
    Thanks
    RaviKishore

    In the context of an OLAP cube the offending expression will be part of the cube's mapping. As already pointed out, there are a number of functions that aren't compatible. Here is the oracle documentation for the error.
    ORA-30353 expression not supported for query rewrite
    Cause: The SELECT clause referenced UID, USER, ROWNUM, SYSDATE, CURRENT_TIMESTAMP, MAXVALUE, a sequence number, a bind variable, correlation variable, a set result, a trigger return variable, a parallel table queue column, collection iterator, a non-deterministic date format token RR, etc.
    Action: Remove the offending expression or disable the REWRITE option on the materialized view.
    The most common cause in my experience is handling dates with either TO_DATE or TO_CHAR functions. If these functions do not have an explicit date format, then you will hit this error.

  • Error when trying to enable cube  MV query rewrite

    Hi
    I'm facing a problem when trying enable query rewrite on the cube materilized view, see below
    Invalid Metadata Objects:
    Invalid Object "ACCOUNTING.APP_CUBE": "XOQ-01957: The cube has REWRITE MVs and also contains either a ragged or skip-level hierarchy. The hierarchy is "ACCOUNTING.MACHINE.MACHINES"."
    As far as I can tell the dimension should not have ragged or skip-level hierarchy as I understand it (having just read up on them now). The dimension only has two levels ALL_MACHINES and MACHINE. The mapping points to a table that has just 1 column the machine_key which has 8 just rows. This joins with a fact table that has just these 8 distinct values in it (and no NULLS).
    Am I missing something obvious?
    Thanks
    Simon

    Each 11g hierarchy has two properties that can be seen in the XML template for the dimension.
    IsSkipLevel
    IsRagged
    For example
    <LevelHierarchy
    Name = "MACHINES"
    IsSkipLevel = "True"
    IsRagged = "True">
    If you do not see them, then the default is False.
    You should think of these properties as 'constraints' in the RDBMS sense. For example, if you say
    IsSkipLevel = "False"
    then the system will interpret this as a constraint that says that the hierarchy is not skip level -- i.e. all parents are always exactly one level above their children. This constraint is validated during dimension load (or, more precisely, dimension COMPILE). If you say it is not skip level and the server finds that it is skip level, then you will get an XOQ-01713 error during the load. If, on the other hand, you say
    IsSkipLevel = "True"
    then the system will interpret this as no constraint, so it will not check during load. Note that this does not say that there are skip levels in the hierarchy, it just says that the server will not check for skip levels. It is similar to an IS NOT NULL constraint on a column -- If the constraint is there then you can be sure that there are no NULLs; if it is not there, then there may or may not be NULLs.
    The double negative implied in the XML property name is unfortunate -- a better name would have been something like "EnableNoSkipLevelConstraint = True", but the choice was made and backwards compatibility requirements makes it hard to change now.
    Your specific error, XOQ-01957, is saying that the MACHINE hierarchy of the MACHINES dimension is marked as IsSkipLevel = "True" or IsRagged = "True". (It is probably both.) In other words the skip level and ragged constraints are not enabled on the hierarchy. To fix this you should flip the two properties to False in the XML and recreate the dimensions. Unfortunately you cannot change the properties directly in AWM 11.1 since AWM tries to manage the properties automatically for you. But there are times, like, this, when things go wrong.

  • ? Mail [12721] Error 1 performing query: WHERE clause too complex...

    Console keeps showing this about a zillion times in a row, a zillion times a day: "Mail [12721] Error 1 performing query: WHERE clause too complex no more than 100 terms allowed"
    I can't find any search results anywhere online about this.
    Lots of stalls and freezes in mail, finder/os x, and safari -- freqent failures to maintain a broadband connection (multiple times every day).
    All apps are slow, cranky with interminable beach balls getting worse all the time.
    anyone know what the heck is going on?

    Try rebuilding the mailbox to see if that helps.
    Also, how much disk space is available on your boot drive?

  • Dashboard Prompt - Getting error for Adding SQL query in "Default to"

    Hello Oracle,
    I am facing some problem in Dashboard Prompt. Like when i add some sql query in "Default to" in Dashboard prompt and for the next prompt when i check for Contrain option i get error in the second prompt. but it works fine when i hard-code a value in "Default to" options.
    For Example:
    Like when we consider a two prompts :
    1) Year -> (In Default to i select SQL Query and enter the query as SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)
    2) Business Unit -> (In specific value i give as some hard code value of Business Unit and check the contrain option)
    i get error as
    Business Unit
    Error Generating Drop Down Values
    A numeric value was expected (received "SELECT "YTD Dim"."Fiscal Year" FROM "YTD Report" WHERE "YTD Dim"."Fiscal Year" = Year(Current_Date)"). Error Details
    Error Codes: EHWH2A7E
    but i get correct value for Year as 2011.
    I need to use SQL query in default to option and need to check the constrain option too.
    Looking for positive feedback.

    You need to create a dashboard prompt and in Default To -> select SQL Results
    Click on the ... (three dots ) underneath it and put in your sql
    For Example , I have a Table called "Sales Date" in my "ABC" presentation folder. This has a column called "Year" and "Date". If I want to have a Year prompt with the default value set to current year, here is what the syntax of my sql result will be :-
    SELECT "ABC"."Sales Date".YEAR
    FROM "ABC"
    WHERE "Date" = current_date
    In SQL, we cannot put SQL as we know of in terms of Oracle, Sql Server etc. The SQL here refers to sql as OBIEE understands it and should be in the form of Select "Presentation foler"."Table Name".ColumnName from "Presentation Folder"
    Hope this helps

  • Getting error when we execute query in RSRT1

    Hi Gurus,
    I Loaded Transaction data in "0CCA_C11" cube and also loaded master data too.
    but when i execute query in RSRT1 i am getting error message
    1) Could not enter feature 0COSTCENTER__0PROFIT_CTR with SID 133 into table /BI0/SIOBJNM
    2)System error in program CL_RSR and form GET_CHANMID-02- (see long text)
    3)Error when generating dataProvider.
    For 0COSTCENTER i loaded master data but for '0PROFIT_CTR' i am unable to load Hierarchy data because still the request is yellow even showing 58 from 58 records.
    can any once can help me to soleve this issue.
    Thanks in advance.
    Raju.k
    *points to be assigned.

    Raju,
      Try replicating your hierarchy DS and reload data.
    hope it helps,
    balaji

  • Query rewrite error QSM-01219

    Hi,
    When having a query run with the REWRITE_OR_ERROR hint the query fails with:
    QSM-01151: query was rewritten
    QSM-01209: query rewritten with materialized view, CM_FT_FX1_MV, using text match algorithm
    QSM-01219: no suitable materialized view found to rewrite this query
    What do these error then mean? Does this mean that the MV wasn't found or that the MV had issues? This worked before and the only change was that we upgraded the database from version 10.2.0.1 to 10.2.0.3.
    If the MV name is specified in the hint REWRITE_OR_ERROR(CM_FT_FX1_MV) then the query works fine. Is something like this supported in Oracle: REWRITE_OR_ERROR(MV1,MV2,......) ?
    Did anyone encounter similar issue?
    Thanks,
    Zrinka

    Since you have not posted more details, see if your case is similar to bug 7201596 on metalink.

  • !! Getting error while using function in where clause

    Hi,
    I have created a function as below
    create function find_cnt(n varchar2)
    return number is
    cnt number;
    begin
    execute immediate 'select count(1) from '||n into cnt;
    return nvl(cnt,0);
    end;
    and when running the below select
    select find_cnt(object_name),object_name from user_objects where object_type='TABLE' and find_cnt(object_name)=0
    I getting
    ERROR:
    ORA-04044: procedure, function, package, or type is not allowed here
    ORA-06512: at "SCOTT.FIND_CNT", line 5
    can anyone help????????
    thanks
    Harish

    In 11g you could simply do
    SQL> select table_name, trim(column_value) cnt
      from user_tables, xmltable(('count(ora:view("'||table_name||'"))'))
    TABLE_NAME                     CNT      
    DEPT                           4        
    BONUS                          0        
    SALGRADE                       5        
    DEMO_USERS                     2        
    DEMO_CUSTOMERS                 7        
    DEMO_ORDERS                    10       
    DEMO_PRODUCT_INFO              10       
    DEMO_ORDER_ITEMS               16       
    DEMO_STATES                    51       
    DEMO_PAGE_HIERARCHY            18       
    TABLE1                         6        
    TABLE2                         6        
    CREATE$JAVA$LOB$TABLE          0        
    CLICKS                         1        
    T                              0        
    EMP                            14       
    PLAN_TABLE                     2        
    17 rows selected.

  • Materialized Views with Query Rewrite is not getting re-written

    I have tried everything that has been mentioned in all the forums here and on metalink to fix this issue, has any smart APEX user found a solution?
    The issue is the MV with Query rewrite capability is not being re-written.
    Things I have tried
    1) give all Query Rewrite privileges to all 3 APEx schemas and parsing schema;
    2) check trace files with tkprof;
    3) dynamically printed explain plan from v$_SQL on the page while executing the query;
    4) to test in a different environment i created an another DAD using the pl/sql webtool kit and tried the same thing and rewrite works like a charm...
    whats the issue here...why are apex schemas not re-writing the queries????
    appreciate any help...thanks

    Jes, per your request
    --create materialized view
    CREATE MATERIALIZED VIEW "RPLANSWEB"."MV_FCG_ALL_SUMMARY_TAB"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 81920 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "RPLANSWEB"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH FORCE ON DEMAND
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    ENABLE QUERY REWRITE
    AS SELECT fcg, year, fcg_desc,
    fac, efr, fac_desc, efr_desc,
    ums_round, fcg_allow_drillable allow_drillable,
    MAX(category_code_um1) category_code_um1,
    SUM(perm_asset) perm_asset,
    SUM(temp_asset) temp_asset,
    SUM(semi_asset) semi_asset,
    SUM(lease_asset) lease_asset,
    SUM(planned_constr) planned_constr,
    SUM(all_perm_asset) all_perm_asset,
    SUM(total_asset) total_asset,
    SUM(allow) allow, SUM(rqmt) rqmt,
    SUM(perm_planned_constr) perm_planned_constr,
    SUM(perm_planned_constr_rqmt_delta) perm_planned_constr_rqmt_delta,
    ROUND(DECODE(SUM(rqmt), 0, 0, SUM(all_perm_asset)/SUM(rqmt)*100)) perm_rqmt_pctsat,
    ROUND(DECODE(SUM(allow), 0, 0, SUM(all_perm_asset)/SUM(allow)*100)) perm_allw_pctsat,
    ROUND(DECODE(SUM(rqmt), 0, 0, SUM(total_asset)/SUM(rqmt)*100)) total_rqmt_pctsat,
    ROUND(DECODE(SUM(allow), 0, 0, SUM(total_asset)/SUM(allow)*100)) total_allw_pctsat,
    ROUND(DECODE(SUM(all_perm_asset), 0, 0, SUM(rqmt)/SUM(all_perm_asset)*100)) perm_rqmt_pctutl,
    ROUND(DECODE(SUM(all_perm_asset), 0, 0, SUM(allow)/SUM(all_perm_asset)*100)) perm_allw_pctutl,
    ROUND(DECODE(SUM(total_asset), 0, 0, SUM(rqmt)/SUM(total_asset)*100)) total_rqmt_pctutl,
    ROUND(DECODE(SUM(total_asset), 0, 0, SUM(allow)/SUM(total_asset)*100)) total_allw_pctutl,
    SUM(coarse_screen_asset) coarse_screen_asset,
    SUM(total_excess) total_excess,
    SUM(total_deficit) total_deficit,
    SUM(perm_excess) perm_excess,
    SUM(perm_deficit) perm_deficit,
    SUM(all_perm_excess) all_perm_excess,
    SUM(all_perm_deficit) all_perm_deficit,
    SUM(temp_excess) temp_excess,
    SUM(satisfy_rqmt) satisfy_rqmt
    FROM summary_tab_dd
    GROUP BY fcg, year, fcg_desc,
    fac, efr, fac_desc, efr_desc,
    ums_round, fcg_allow_drillable;
    sql plus> log in as parsing schema user (not APEX_PUBLIC_USER)
    sql plus> SELECT fcg, year, fcg_desc,
    SUM(perm_asset) perm_asset,
    SUM(perm_excess) perm_excess,
    SUM(perm_deficit) perm_deficit,
    SUM(all_perm_excess) all_perm_excess,
    SUM(all_perm_deficit) all_perm_deficit,
    SUM(temp_excess) temp_excess,
    SUM(satisfy_rqmt) satisfy_rqmt
    FROM summary_tab_dd
    where year=2007
    GROUP BY fcg, year, fcg_desc;
    --execution plan
    SELECT STATEMENT     ALL_ROWS     12     291     17460                         
    HASH(GROUP BY)          12     291     17460                         
    MAT_VIEW REWRITE ACCESS(FULL) RPLANSWEB.MV_FCG_ALL_SUMMARY_TAB     ANALYZED     11     291     17460                         "MV_FCG_ALL_SUMMARY_TAB"."YEAR"=2007
    --execution plan from sql workshop (application express)
    SELECT STATEMENT 42,341 55 3,882 1,990,027
    HASH GROUP BY 42,341 55 3,882 1,990,027
    TABLE ACCESS FULL SUMMARY_TAB_DD 109,158 47 3,329 5,130,426 "YEAR" = 2007
    --execution plan from an APEX page (displayed from v$sql and V$SQL_PLAN)
    OPERATION: SELECT STATEMENT OPTIONS: OBJECT_NAME: OBJECT_ALIAS: OBJECT_TYPE: OPTIMIZER: ALL_ROWS SEARCH_COLUMNS: 0 COST: 4600 CARDINALITY: BYTES: CPU_COST: IO_COST: ACCESS_PREDICATES: FILTER_PREDICATES: PROJECTION:
    OPERATION: HASH OPTIONS: GROUP BY OBJECT_NAME: OBJECT_ALIAS: OBJECT_TYPE: OPTIMIZER: SEARCH_COLUMNS: 0 COST: 4600 CARDINALITY: 109158 BYTES: 8732640 CPU_COST: 549150132 IO_COST: 4569 ACCESS_PREDICATES: FILTER_PREDICATES: PROJECTION: "FCG"[VARCHAR2,6], "FCG_DESC"[VARCHAR2,15], SUM("PERM_DEFICIT")[22], SUM("PERM_EXCESS")[22], SUM("SATISFY_RQMT")[22], SUM("TEMP_EXCESS")[22], SUM("ALL_PERM_EXCESS")[22], SUM("ALL_PERM_DEFICIT")[22], SUM("PERM_ASSET")[22]
    OPERATION: TABLE ACCESS OPTIONS: FULL OBJECT_NAME: SUMMARY_TAB_DD OBJECT_ALIAS: SUMMARY_TAB_DD@SEL$1 OBJECT_TYPE: TABLE OPTIMIZER: SEARCH_COLUMNS: 0 COST: 3329
    as you can see while executing the script in sql developer the optimizer is finding the relevant materialized view, not in the case of APEX's SQL Workshop or Page.
    appreciate your time

  • Getting error while executing the SQL ( ver 8.1.7.0.0)

    I am running a simple query involved with joins. When i ran the query with first set of criteria mentioned in the WHERE clause there is no problem. But when I try to run the same just by doing some correction in the WHERE clause, following errors is shown. I tried doing this from TOAD and SQL Analyser. I am getting the same output.
    ORA-01114: IO error writing block to file 4 (block # 524242)
    ORA-27069: skgfdisp: attempt to do I/O beyond the range of the file
    OSD-04026: Invalid parameter passed. (OS 524247)
    ORA-01114: IO error writing block to file 4 (block # 524242)
    ORA-27069: skgfdisp: attempt to do I/O beyond the range of the file
    OSD-04026: Invalid parameter passed. (OS 524247)
    Can anyone suggest what is this error all about and resolution for the same. Thanks.
    Regards
    Srinivasan B

    Could be a problem with your temp tablespace. Especially if your query is doing a large sort (merge) operation. Usually a simple select does not write any IO. With expetion from the temp tablespace. But I would have expected another error message then.
    Without exactly knowing what the problem is i'm hesitant to give an advice. But rethinking your query could be a good starting point.
    Message was edited by:
    Sven Weller

  • Using DBMS_METADATA.GET_DDL get error: ORA-00907: missing right parenthesis

    Hi,
    I'm trying to extract schema DDL from a database (10.2.0.4.0 - 64bit Enterprise Edition on Solaris 10). I run the query below and get an ORA-00907: missing right parenthesis error.
    SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN ('TABLE_PARTITION','INDEX_PARTITION','LOB');
    This is the output when running the above in sqlplus worksheet
    select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects where object_type not in ('TABLE_PARTITION','INDEX_PARTITION','LOB')
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    removing the where clause gives the following:
    select DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') as object_type, object_name) FROM user_objects
    ERROR at line 1:
    ORA-00907: missing right parenthesis
    Any pointers would be gratefully received. I know I could get the DDL out using exp/imp but I want to understand why I'm getting the missing parenthesis error.
    cheers,
    Ewan

    SELECT DBMS_METADATA.GET_DDL( REPLACE(object_type,' ','_') AS object_type, object_name) FROM user_objects WHERE object_type NOT IN You don't need an alias here. Get rid of " AS object_type" and it should work.

Maybe you are looking for

  • Report Painter Report- Export to Excel

    Hi Gurus, How to export report painter report to excel. I could not use the following methoads 1. Under Settings Option, Office Integration, MS Excel is provided. For Secutity reasons, it was blocked. So can't be used. 2. Could not run as backgroud a

  • ABAP DUMP : filed overflow errror

    Hi ,. I have a field which is referenced to the   data element VGWRT( Datat type  QUAN , length 9 , decimla places 3 ) .  In run time this field is getting a very huge value and giving the abap dump saying the filed overflow . How can i avoid this pr

  • Does anyone know when the next upadate will be?

    does anyone know when the next upadate will be?

  • PROBLEM WITH IMPORT FILES

    I work with Adobe Premiere Pro CS 6.0. When I import the files in the MXF format, it's sorted by timecode in list view. BUT! it's sorted in icon view randomness. Why? How change the preferences to sort files in icon view by timecode?! Thank you

  • Search by category, release 2

    Search by category in the custom and advanced search portlets doesn't give correct results. When searching for items in category 'A', the search results page shows files that are in category 'General' as well. How can we solve or work arround this?