Rewriting query clause error

Hi all;

I did not finish the rewrite of the query (M.view) clause, trying to activate I get the error message
and I asked this question "https://forums.oracle.com/forums/thread.jspa?threadID=2543789".
Question incorrectly displayed data communication model. -If this isn't a duplicate thread.

Please answer me what was missing here?

SQL > alter system set query_rewrite_enabled = 'TRUE' scope = SPFILE;
SQL > grant query rewrite in *;
Grant succeeded.
conn xxx/xxxx@xxxxxx
1 SQL > ALTER SESSION SET OPTIMIZER_MODE = FIRST_ROWS.
Altered session.
2 SQL > alter session set query_rewrite_enabled = true;
Altered session.
3 SQL > execute dbms_stats.gather_table_stats ('rose', 'mv1');
PL/SQL procedure successfully completed.
4 SQL > exec dbms_mview.explain_rewrite ("select * sales ', but '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 1
thanks in advance...

Hello

Run utlxrw.sql to create the table.

concerning

Tags: Database

Similar Questions

  • Query clause ignores to export records

    Hi all;

    I am trying to export a few records from table but query clause the customer the throwing error.

    SCOTT > customer desc

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    NUMBER OF CUST_ID

    CUST_NAME VARCHAR2 (15)

    VARCHAR2 (15) REGION

    NUMBER OF CUST_CREDIT_LIMIT

    $ expdp System/Manager dumpfile = dp:1.dmp tables = scott.customers query = scott. "CUSTOMERS:" where exists (select cust_id from CUSTOMERS c where cust_credit_limit > 12400 and ku$ .cust_id = c.sust_id) "" reuse_dumpfiles = yes

    Export: Release 11.2.0.1.0 - Production on Fri Aug 7 17:11:32 2015

    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    Start "SYSTEM". "" SYS_EXPORT_TABLE_01 ": System / * dumpfile = dp:1.dmp tables = scott.customers query = scott. CUSTOMERS: "where exists (select cust_id from CUSTOMERS c where cust_credit_limit > 12400 and ku$ .cust_id = c.sust_id)" reuse_dumpfiles = yes "

    Current estimation using BLOCKS method...

    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

    Total estimation using BLOCKS method: 64 KB

    Object type TABLE_EXPORT/TABLE/TABLE processing

    ORA-31693: Table object data 'SCOTT '. "' CUSTOMERS ' could not load/unload and being ignored because of the error:

    ORA-00942: table or view does not exist

    Main table 'SYSTEM '. "" SYS_EXPORT_TABLE_01 "properly load/unloaded

    ******************************************************************************

    Empty the file system set. SYS_EXPORT_TABLE_01 is:

    /U01/DataPump/1.dmp

    Work 'SYSTEM '. "" SYS_EXPORT_TABLE_01 "completed with error (s 1) at 17:11:50

    Hello

    I think the problem is that you run the job as system by default, all object references are to the system, you need to change

    $ expdp System/Manager dumpfile = dp:1.dmp tables = scott.customers query = scott. "CUSTOMERS:" where exists (select cust_id from CUSTOMERS c where cust_credit_limit > 12400 and ku$ .cust_id = c.sust_id) "" reuse_dumpfiles = yes

    TO

    $ expdp System/Manager dumpfile = dp:1.dmp tables = scott.customers query = scott. "CUSTOMERS:" where exists (select cust_id scott. CUSTOMER c where cust_credit_limit > 12400 and ku$ .cust_id = c.sust_id) "" reuse_dumpfiles = yes

    I also recommend that you use one parfile to avoid problems of interpretation of the characters by the shell

    See you soon,.

    Rich

  • block based query clause

    Hi all...

    I use form 10g...
    When I tried the query clause from block...
    I used this query (SELECT * FROM exit INNER JOIN enter ON exit.ent_num = enter.ent_num where to enter departure = 1)...
    When I run the form...
    error frm-40505 oracle unable to execute the query

    Thank you

    Published by: osa3_12 on December 10, 2009 04:33

    Hello

    I think that you are joining two tables which have duplicate column names... In this case you must give the name of different aliases for the similar columns... You cannot use select *...

    Should be selected enter.ent_num enter_ent_num, exit.ent_num exit_ent_num...

    concerning
    Dora

  • JDeveloper does not support the SQL expert, cannot add query clause to view link

    For developers who can know:

    I use JDeveloper 10.1.3.4 and I have two tables, we're STUDENTS, the other is the PRICE, with a one-to-many relationship (a student may have several awards), and ID is the foreign key:
    STUDENTS
    ------------------------
    ID    NAME    DOB
    ------------------------
    9999  JOHN    01/02/1990
       |  
       |  
       |  
       |           AWARDS
       |           ------------------------
       |           ID      DESC      AMOUNT
       |           ------------------------
       ----------- 9999    PELL      500
                   9999    PERKINS   800
                   9999    LOAN      900
    In the application, when a student (9999, JOHN) connects, the information above is displayed. I need to add up all the awards for the student and to display not only the elements of price, but also the total amount of all awards. To do this, I created another object to view named TotalAwards in the object entity the price just to get the total amount. The SQL code of the VO's
    SELECT SUM(Awards.AMOUNT) AS TOTAL
    FROM AWARDS Awards
    Then, a link is created between the students and the TotalAwards, and use of the new link to the view is added to the application module. TotalAwards is now available in the data control palette to be drag-and - drop to pages.

    Problem occurs when the application is invoked. An error is caught before the application can begin. The error message indicates that "the ends or the link view do not specify an attribute.

    It seems that the TOTAL 'SUM (Awards.AMOUNT) AS TOTAL' is not recognized as an attribute. I have reviewed the query clause in the display link to see if it is there, such as:
             Attribute        Bind Variable
             ------------     --------------
             Students.ID      :Bind_Id
    
    
    WHEHE    :Bind_Id = Awards.ID
    There is no such clause in the query clause page. And I can not add a no more, because the page is grayed out and disabled. I think maybe it's for the same reason: TOTAL is not recognized as an attribute of the price.

    How to get around the problem? Or are there other ways to summarize the total amount and view it in the browser?

    Thank you very much for help!


    Newman

    Hello

    Here you have a solution for the TOTAL:
    http://www.freewebalbum.com/blogs/faces/bjanko/blogs.jsp?blog=bjanko20070725180020

    Kind regards

    Branislav

  • Questions HFR - "5200: query execution error: invalid item ID".

    Hi all

    We use the Hyperion HFM 11.1.1.3 application. We have recently upgraded to the Oralce Database 11.2.0.2 and reconfigured the HFM application with this new version of the database. When I tried to run the Financial reporting via the HFR studio, I get the error message - ' 5200: query execution error: invalid item ID ". Please could you help me solve this problem.

    Thank you

    Michel K

    It was because of the default angle that is invalid for the user which was inconsistent with the special report.

    Change the preferences to the preview from the user Point of view and rerun the report.

    File > preference > Financial Reporting > preview select 'ON' box under the Point of view.

    Re-run the report, then select the desired POV.

    This will prompt the user to change their POV every time that he or she opens a report. They can select the correct POV and the report runs successfully.

    You can turn off later. Let me know if it solved that problem.

  • Impossible to activate the rewrite of the query, no error

    Hello

    I created a simple MV with activated query rewrite, and it works well. The MV is very simple:

    Mv_sales CREATE MATERIALIZED VIEW

    NOLOGGING

    REFRESH THE STRENGTH TO DEMAND

    ACTIVATE THE QUERY REWRITING

    AS

    SELECT

    s.cust_id,

    Sum (s.QUANTITY_SOLD) sold_qty,

    Sum (s.AMOUNT_SOLD) sold_amt

    S SALES

    GROUP BY s.cust_id

    ;

    I tested the mechanism of query rewriting, and everything works as expected.

    Now, I created an another MV with a motion very similar to the one above, but with several tables.

    An excerpt from the new query:

    SELECT...

    Of

    FACT_SALES_AND_MARKDOWNS FSM

    DIM_PRODUCT DP

    DIM_LOCATION DL

    DIM_DATE DD

    WHERE WSF. DIM_PRODUCT_KEY = DP. DIM_PRODUCT_KEY

    AND WSF. DIM_LOCATION_KEY = DL. DIM_LOCATION_KEY

    AND WSF. DIM_SALE_DATE_KEY = DD. DIM_DATE_KEY

    GROUP BY

    DD MERCH_YEAR_ID.

    DD. MERCH_YEAR_START_DATE...

    I can create the MV, but the query rewriting will not activate!

    If I execute ALTER materialized view mv_test ALLOW to REWRITE the QUERY. It runs without giving me an error, but the MV is not always activate the rewrite of the query.

    Am I missing something? Can we not have Query Rewrite on a MV with several tables in the query?

    Thank you

    Joao Moreira

    Hello

    Please provide the results of these queries:

    Select MVIEW_NAME, REWRITE_ENABLED

    of DBA_MVIEWS

    where MVIEW_NAME = '';

    Kind regards.

  • WITH query Clause does not work in Oracle reports.

    Hi gurus,

    I use a query WITH clause and want to create a report by using the same query.

    But when I am trying to build a report, request gives error like "WITH clause table or view does not exist.

    But the same query works perfectly in line of sql.

    Does support the Oracle WITH clause query reports?

    Please suggest.


    Thank you
    Onkar

    I met a similar problem before and worked around it by moving the query to a pipeline function in the database as described in the unexpected CLAUSE causes ORA-00942 in Report Builder

    I hope this helps.

  • Query execution error

    Hello

    I'm having a hard time finding this error message.

    Run database query error.
    General error: unknown table 'photoid' by MULTI DELETE

    The error occurred in C:\Inetpub\wwwroot\homes\commuser\deletephoto.cfm: line 32

    30: DELETE photoID adID, contactID, photoType, legend, ThumbURL, ThumbPath, FullURL and FullPath
    31: IMAGES
    32: WHERE photoID IN (#form.photoID #) AND phototype = 2
    33: < / cfquery >
    34:

    That happens before is another query is executed and some files are deleted on the server (no problem), then the database records that are stored the paths to these files are removed, and is where he chokes. The above query deletes several files at the same time according to how much is checked on the form template.

    This used to work on a database Access, but I've migrated to mySQL recently and just started to rewrite code.

    I don't have any table called 'photoID' so this error message does not tell me much.

    Thank you...

    You do not specify a field in a delete query - you just delete the records together

  • Connect By hierarchical query clause-

    Hello

    I wrote a query using the Connect By clause to generate the table data structure tree with appropriate levels.

    But given could not correct as there may be data that did the trick. As Table1 is parent from table 2 and table 2 is parent from table 3 and table 3 is again Parent from table 1. If these incorrect data then I get error Oracle "ORA-01436: CONNECT loop in the user data" which is correct.

    What I need is, whenever this error message is triggered I give my own error instead of this Oracle error message in the SQL statement. Please note that I do not use any PLSQL block, I have just one SQL statement. Appreciate any help on this topic. Thank you.

    Hello

    Outside of PL/SQL, I don't know anyway to substitute your own error messages for those that oracle provides.

    In Oracle 10 (and more), you can write a query using the CONNECT_BY_ISCYCLE pseudo-column. Using CONNECTION BY NOCYCLE, the query will never actually throw the error ORA-01436, but you can get it to display your message in the case there, you not used CONNECT BY NOCYCLE.

    Here's how:
    Equip your actual query, CONNECT_BY_ISCYCLE, the WITH clause.
    Get this subquery (CONNECT_BY_ISCYCLE) MAX. We'll call this max_cbi.
    Do a UNION ALL of two pins:
    (1) selects everything (except, pehaps, CONNECT_BY_ISCYCLE), subquery, WHERE max_cbi = 0
    (2) allows you to select your 'error message' double, WHERE max_cbi = 1.

    Published by: Frank Kulash, November 26, 2008 14:09

  • Query Builder: Error Message 'Unexpected token "over" '

    Hello

    I use Version 4.1.3.20 of the SQLDev.

    I have a SQL query that contains

    count (*) over (partition of...)

    and

    listagg (col1, ',') within the Group (order in...) more than (partition of...)

    It works well in my spreadsheet calculation, but when I switch to the Query Builder, I get the following message is displayed:

    Text contains unsupported syntax.

    Parse error:

    Cannot parse the SQL query.

    Invalid SELECT statement.

    Unexpected token 'over' at line 19, pos 25.

    Ask people with disabilities Builder.

    Is this a bug or just feature which is not yet converted?

    Best regards

    Sabine

    I doubt that the Query Builder supports little advanced SQL

  • Query clause

    Hello

    I use this query in a from clause

    SELECT PM.PATIENT_FILE_NO,
           PE.EPISODE_NO,
           DECODE(CURRENT_LANG_P_S,
                  'P',
                  PATIENT_NAME_P || ' ' || PATIENT_NAME_2_P || ' ' ||
                  PATIENT_NAME_3_P || ' ' || PATIENT_NAME_F_P,
                  PATIENT_NAME_S || ' ' || PATIENT_NAME_2_S || ' ' ||
                  PATIENT_NAME_3_S || ' ' || PATIENT_NAME_F_S) PATIENT_NAME,
           PE.START_DATE,
           PE.END_DATE,
           EXSYS.GET_AGE(PM.DATE_OF_BIRTH) AGE,
           CODES_PKG.GET_DESCRIPTION(PM.GENDER, 103) GENDER,
           PE.ATTENDANCE_TYPE,
           PATIENT_CATEGORY
      FROM RC_PATIENTS PM, RC_PATIENT_EPISODES PE
     WHERE PM.PATIENT_FILE_NO = PE.PATIENT_FILE_NO
       AND PE.STATUS != 'C'
    
    

    The query works in "pl/sql Developer", but when I run the form I had 'query caused no records to retrieve.

    -I wrote

    go_block ('block_name');

    execute_query;

    in a trigger w-n-f-i

    -J' have elements compatible with the number and names of the collected columns of the query, but I have more elements in the same block

    ??

    I found it, thanks

    There are certain triggers prevent execution of code

    Thank you

  • PIVOT query throwing error

    I have a request pivot within a region of APEX (pl sql function return sql query) report

    declare
      v_term_pivot varchar2(500);
      PIVIN LONG;
      cursor xtoy is SELECT distinct d.JOB FROM emp d;
      v_query LONG;
    begin
      OPEN xtoy;
      LOOP
      FETCH xtoy into v_term_pivot;
      EXIT when xtoy%NOTFOUND;
      PIVIN:=PIVIN||''''||v_term_pivot||''' "'||substr(v_term_pivot,1,30)||'", ';
      END LOOP;
      v_query:='SELECT * FROM
      (SELECT x.ENAME, x.JOB, x.SAL FROM emp x)
      PIVOT (
      SUM(x.SAL)
      FOR x.JOB IN ('||substr(PIVIN, 0, length(PIVIN)-1)||')
      )
       order by 1;';
      --dbms_output.put_line(v_query);
      RETURN v_query;
    end;
    
    

    Get an error:

    Failed to parse the SQL query:

    ORA-01748: only here allowed simple column names

    Can someone advice how can this be corrected?

    I reworked the code to use the scott. EMP table.

    I got the SQL Select function resulting and he ran in SQL Developer.

    Syntax 1

    You must remove aliases for tables of the PIVOT() section.

    line 16 and 17 should be

    SUM (SAL)

    FOR USE IN (...)

    Syntax 2

    Line 11: you add comma and space (2 characters)

    Line 17: you remove only 1 tank

    Syntax 3 (problem semi)

    Although the APEX works with it, I would abandon the semicolon (;) to the end.

    To name the columns, you must create a function that returns the name of the report column.

    Again, this must match the columns listed in the SELECT part

    reminder of my warning:

    Using a "SELECT *" and lack of "ORDER BY" in your cursor will cause you problems. (maybe not now, but it will.)

    MK

  • Financial Reporting Exception - query execution error: java.lang.Arithmetic

    Hi all

    I use the Financial Reporting Studio 11.1.2.507 to develop a report to a planning application, so I use a connection of planning to do. This report contains some Calc and I'm sure it's possible generate a division by zero. But what is coming: I started to develop this report using the admin user and no error has been shown. Then when I tried to access this report with one user other than the admin user, the error occurs: "error running query: java.lang.ArithmeticException: / by zerojava.lang.ArithmeticException.
    So, have you seen this scenario before?
    Could you help me with this problem?

    PS: if I was not clear enough, please tell me!

    Best regards,
    Rafael Melo - Brasil

    No problem. The POV that you set in Studio EN automatically applies to all users. You don't need to do anything else. It could be a security issue. I just assumed the POV for the test user is probably mapped to the dimension itself as entity and as the test user doesn't have access to the entity, you get the error message.

    To resolve this issue, connect to the workspace > Explore > file > Preferences > Financial Reporting > user Point of view > preview. Make sure that the option 'On' is selected.

    I hope this helps.

    Mehmet

  • Not a GROUP BY clause error

    Hi all

    Can someone tell me what is wrong with the query below? I get an exception is NOT a GROUP OF CLAUSE:
    SELECT
            LAST_DAY((xxx.timevalue)) as  SUMMARYDATE
          , xxx.acct AS ACCTNUM
          , xxx.referenceid AS SEARCHTYPE
           , CASE WHEN NVL(xxx.PRIMARYSRCH_IND,'N') = 'Y' THEN COUNT(xxx.searchid) ELSE 0 END  Cnt_PrimarySearches
                   , CASE WHEN NVL(xxx.primarysrch_ind,'N') = 'N' THEN COUNT(xxx.Searchid) ELSE 0 END  Cnt_SecondarySearches
         
          FROM XXX_Tablename xxx
          WHERE
           xxx.referenceid NOT IN ('Alert','Search','Collection')
          GROUP BY
      LAST_DAY((xxx.timevalue))  
      , xxx.acctnum
      , xxx.referenceid 

    Hello

    Try this

    SELECT
            LAST_DAY((xxx.timevalue)) as  SUMMARYDATE
          , xxx.acct AS ACCTNUM
          , xxx.referenceid AS SEARCHTYPE
           ,COUNT( CASE WHEN NVL(xxx.PRIMARYSRCH_IND,'N') = 'Y' THEN (xxx.searchid) ELSE 0 END  Cnt_PrimarySearches)
                   , COUNT(CASE WHEN NVL(xxx.primarysrch_ind,'N') = 'N' THEN (xxx.Searchid) ELSE 0 END) Cnt_SecondarySearches
    
          FROM XXX_Tablename xxx
          WHERE
           xxx.referenceid NOT IN ('Alert','Search','Collection')
          GROUP BY
      LAST_DAY((xxx.timevalue))
      , xxx.acctnum
      , xxx.referenceid
    

    Not tested

  • Select the query gives error

    Hello

    I executed the query below

    SELECT CUREPRESS, PRODUCTIONCODE, ENDDATE YYYYMMDD.

    CASE

    WHEN annex 1 > 0 AND SCHEDULE2 > 0 AND THEN schedule3 > 0 AND ROUND(22+SCHEDULE3/CURECAPACITY*24,0) > 24
    Round (22 +(SCHEDULE3/CURECAPACITY*24) - 24, 0)-(DATE of the INCREASE OF 1)
    WHEN annex 1 = 0 AND SCHEDULE2 = 0 AND schedule3 > 0 AND ROUND(22+SCHEDULE3/CURECAPACITY*24,0) < = 24 THEN
    Round(22+SCHEDULE3/CURECAPACITY*24,0)
    WHEN annex 1 > 0 AND SCHEDULE2 > 0 AND schedule3 = 0 THEN
    Round(14+SCHEDULE2/CURECAPACITY*24,0)
    WHEN annex 1 > 0 AND SCHEDULE2 = 0 AND = 0 THEN schedule3
    ROUND (6 +(SCHEDULE1/CURECAPACITY*24), 0)
    END ENDDATE1
    CEN
    SELECT PRODUCTIONCODE, curepress, YYYYMMDD
    OF ORGCURESCHEDULEDAY HAS
    WHERE YYYYMMDD = (SELECT MAX (YYYYMMDD)
    OF ORGCURESCHEDULEDAY B
    WHERE A.PRODUCTIONCODE = B.PRODUCTIONCODE
    AND A.CUREPRESS = B.CUREPRESS)
    ) PRODUCTIONCODE, CUREPRESS, YYYYMMDD GROUP
    ORDER OF CUREPRESS, PRODUCTIONCODE

    But... I get the error message like

    ORA-00904: "CURECAPACITY": invalid identifier
    00904, 00000 - '% s: invalid identifier '.
    * Cause:
    * Action:
    Error on line: column 103: 40


    Pls help me... !!
    SELECT
    CUREPRESS,
      PRODUCTIONCODE,
      STARTDATE,
    
      TO_DATE(TO_CHAR(STARTDATE,'YYYYMMDD') || TO_CHAR(STARTDATE1,'HH24')||':00','YYYYMMDD HH24:MI') STARTDATE1
    
      FROM 
    
    (SELECT CUREPRESS,
      PRODUCTIONCODE,
      YYYYMMDD STARTDATE,
      CASE
        WHEN SCHEDULE1                           = 0
        AND SCHEDULE2                            = 0
        AND SCHEDULE3                            >0
        AND ROUND(30 -SCHEDULE3/CURECAPACITY*24,0)>24
        THEN ROUND(30-(SCHEDULE3/CURECAPACITY*24),0)-24
        WHEN SCHEDULE1                            = 0
        AND SCHEDULE2                             = 0
        AND SCHEDULE3                             >0
        AND ROUND(30 -SCHEDULE3/CURECAPACITY*24,0)<=24
        THEN ROUND(30-SCHEDULE3/CURECAPACITY*24,0)
        WHEN SCHEDULE1 = 0
        AND SCHEDULE2  >0
        AND SCHEDULE3  >0
        THEN ROUND(22-SCHEDULE2/CURECAPACITY*24,0)
        WHEN SCHEDULE1 > 0
        AND SCHEDULE2  >0
        AND SCHEDULE3  >0
        THEN ROUND(14-SCHEDULE1/CURECAPACITY*24,0)
      END STARTDATE1
    FROM
      (SELECT curepress,
        PRODUCTIONCODE,
        YYYYMMDD,
        schedule1,
        schedule2,
        schedule3,
        curecapacity
      FROM ORGCURESCHEDULEDAY A
      WHERE YYYYMMDD =
        (SELECT MIN(YYYYMMDD)
        FROM ORGCURESCHEDULEDAY B
        WHERE A.PRODUCTIONCODE=B.PRODUCTIONCODE
        AND A.CUREPRESS       =B.CUREPRESS
        )
      )
    GROUP BY PRODUCTIONCODE,
      CUREPRESS,
      YYYYMMDD,
      SCHEDULE1,
      SCHEDULE2,
      SCHEDULE3,
      CURECAPACITY)
    ORDER BY CUREPRESS,
      PRODUCTIONCODE
    

    Try please, (not tested)

Maybe you are looking for

  • How can I import my Email from Seamonkey?

    I currently use the sea monkey 2.4.1 for all my email and correspondence.Firefox asked to transfer data from Internet Explorer, so I had to say no.The function synchronize you have would be very useful for me withdesktop and portable computers.

  • Video/DVD Player Toshiba and Windows 8

    I get a response message saying 'your version of the video/DVD Toshiba drive is not compatible with this version of Windows' turn Windows 8 Pro and downloaded the appropriate software on the site of Toshiba for Windows 7 x 64 and ran the software to

  • How can I display an analog input for the PXI-5105 on LabVIEW?

    Hi all I am very very new to LabVIEW and I started to tinker with it. I use the version of LabVIEW 2010 SP1 on Windows 7 OS. I also have the chassis NI SMU-1073 with SMU-6361 and PXI-5105 modules and the chassis is connected to my PC via PCI. I becam

  • WRT110 EasyLink Advisor will not work

    After completing the wizard install the Easylink Advisor application will not work. Also, if I double click the icon on the desktop nothing happens. Anyone has an idea why it won't work? Windows XP Pro

  • PC freezes and Hardrive memory problems

    I have a hp g62 with windows 7 Home Edition on it Sometimes it blocks for awhile and then he unfrezzes then goes over and over again and I need a program to optimize my PC next lot of my windows files take a lot of space on my hard drive im a gamer a