Using Materilaized view in a query .. query is taking time????

Hi I have a query :-
SELECT rownum as id, u.last_name, u.first_name,u.phone phone, u.empid,u.supervisor id
FROM emp_view u -- using view
CONNECT BY PRIOR u.empid = u.supervisor_id
START WITH u.sbcuid = 'ph2755';
here emp_view is a view .
------ The above query is taking 3 sec to execute.
Then I created Materialuized view emp_mv and the the MV query is same as emp_view view query.
After this i executed following sql
SELECT rownum as id, u.last_name, u.first_name,u.phone phone, u.empid,u.supervisor id
FROM emp_mv u -- using materialized view
CONNECT BY PRIOR u.empid = u.supervisor_id
START WITH u.sbcuid = 'ph2755';
this query is taking 15 sec to execute..... :(
can anyone please tell me why MV query is taking time????

Hi,
In your first case you query a view, meaning that you query the underlying tables. These probably have indexes and stats are updated.
In you second case you query a materialized view, meaning that you query the underlying base table of that mview.
This probably do not have the same indexes to support that query.
But of course, I'm just guessing based on the little information provided.
If you want to take this further, please search for "When your query takes too long" and "How to post a tuning request".
These two threads holds valuable information, not only on how to ask this kind of question, but also how to start solving it on your own.
Regards
Peter

Similar Messages

  • Create View taking time

    Hi,
    We are creating a view jusing the following query which is taking time. The query is as below,
    SELECT
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C ,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE=     B.ICD_CODE
                    AND  A. ICD_CODE= C.ICD_CODE
                    AND B.ICD_CODE=D.ICD_9_CD
                    AND B.COMPL_GRP_TXT=D.COMPL_GRP_TXT
                    AND B.COMPL_ICD_CODE<>B.ICD_CODE
                    AND C.PROC_TYPE <>'L'
                    AND B.COMPL_GRP_TXT<>'Reoperations'
                    AND D.COMPL_TYPE_TXT<>'Intra-operative Misadventure'
                    UNION
                    SELECT
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C ,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE=     B.ICD_CODE
                    AND  A. ICD_CODE= C.ICD_CODE
                    AND B.ICD_CODE=D.ICD_9_CD
                    AND B.COMPL_GRP_TXT=D.COMPL_GRP_TXT
                    AND B.COMPL_ICD_CODE<>B.ICD_CODE
                    AND C.PROC_TYPE <>'L'
                    AND D.COMPL_TYPE_TXT = 'Intra-operative Misadventure'
                    AND B.PROC_DAY=C.PROC_DAY
    UNION
                    SELECT
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C ,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE=     B.ICD_CODE
                    AND  A. ICD_CODE= C.ICD_CODE
                    AND B.ICD_CODE=D.ICD_9_CD
                    AND B.COMPL_GRP_TXT=D.COMPL_GRP_TXT
                    AND B.COMPL_ICD_CODE<>B.ICD_CODE
                    AND C.PROC_TYPE <>'L'
                    AND B.COMPL_GRP_TXT='Reoperations'
                    AND B.PROC_DAY>C.PROC_DAY 
                    AND (B.COMPL_ICD_CODE LIKE '45.%' OR   B.COMPL_ICD_CODE LIKE '46.%'           OR          B.COMPL_ICD_CODE LIKE '48.%' OR B.COMPL_ICD_CODE LIKE '49.%')
                    )Here is the explain plan
    PLAN_TABLE_OUTPUT
    | Id  | Operation                         |  Name                    | Rows  | Bytes |TempSpc| Cost  |
    |   0 | SELECT STATEMENT                  |                          |  5443M|   710G|       |  1687M|
    |   1 |  SORT UNIQUE                      |                          |  5443M|   710G|  1598G|  1687M|
    |   2 |   UNION-ALL                       |                          |       |       |       |       |
    |*  3 |    HASH JOIN                      |                          |  5371M|   700G|    34M| 11709 |
    |*  4 |     HASH JOIN                     |                          |   281K|    31M|  4568K|  4679 |
    |   5 |      MERGE JOIN CARTESIAN         |                          | 50225 |  3972K|       |   248 |
    |   6 |       TABLE ACCESS FULL           | EES_ICD_9_CODE           |   123 |  5289 |       |     2 |
    |   7 |       BUFFER SORT                 |                          |   408 | 15504 |       |   246 |
    |*  8 |        TABLE ACCESS FULL          | EES_CLINCL_COMPL_ICD     |   408 | 15504 |       |     2 |
    |*  9 |      TABLE ACCESS FULL            | EES_CLINICAL_COMPL_DATA  |  2088K|    71M|       |  1860 |
    |* 10 |     TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1911K|    41M|       |  2855 |
    |* 11 |    HASH JOIN                      |                          |  5973K|   831M|  7216K|  9081 |
    |  12 |     TABLE ACCESS BY INDEX ROWID   | EES_ICD_9_CODE           |     1 |    43 |       |     1 |
    |  13 |      NESTED LOOPS                 |                          | 55969 |  6558K|       |  4265 |
    |  14 |       NESTED LOOPS                |                          | 55970 |  4208K|       |  3146 |
    |* 15 |        TABLE ACCESS FULL          | EES_CLINCL_COMPL_ICD     |    36 |  1368 |       |     2 |
    |* 16 |        TABLE ACCESS BY INDEX ROWID| EES_CLINICAL_COMPL_DATA  |  1555 | 60645 |       |    88 |
    |* 17 |         INDEX RANGE SCAN          | COMPL_IND_ICD_CODE       | 56875 |       |       |   248 |
    |* 18 |       INDEX RANGE SCAN            | ICD_CODE_INDEX_1         |     1 |       |       |     1 |
    |* 19 |     TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1911K|    47M|       |  2855 |
    |* 20 |    HASH JOIN                      |                          |    65M|  9142M|  8864K|  8943 |
    |* 21 |     HASH JOIN                     |                          | 68740 |  8055K|  5432K|  2781 |
    |  22 |      MERGE JOIN CARTESIAN         |                          | 59762 |  4727K|       |   248 |
    |  23 |       TABLE ACCESS FULL           | EES_ICD_9_CODE           |   123 |  5289 |       |     2 |
    |  24 |       BUFFER SORT                 |                          |   486 | 18468 |       |   246 |
    |* 25 |        TABLE ACCESS FULL          | EES_CLINCL_COMPL_ICD     |   486 | 18468 |       |     2 |
    |* 26 |      TABLE ACCESS FULL            | EES_CLINICAL_COMPL_DATA  |   429K|    15M|       |  1860 |
    |* 27 |     TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1911K|    47M|       |  2855 |
    Predicate Information (identified by operation id):
       3 - access("A"."ICD_CODE"="C"."ICD_CODE")
       4 - access("A"."ICD_CODE"="B"."ICD_CODE" AND "B"."ICD_CODE"="D"."ICD_9_CD" AND
                  "B"."COMPL_GRP_TXT"="D"."COMPL_GRP_TXT")
       8 - filter("D"."COMPL_TYPE_TXT"<>'Intra-operative Misadventure' AND
                  "D"."COMPL_GRP_TXT"<>'Reoperations')
       9 - filter("B"."COMPL_ICD_CODE"<>"B"."ICD_CODE" AND "B"."COMPL_GRP_TXT"<>'Reoperations')
      10 - filter("C"."PROC_TYPE"<>'L')
      11 - access("A"."ICD_CODE"="C"."ICD_CODE" AND "B"."PROC_DAY"="C"."PROC_DAY")
      15 - filter("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
      16 - filter("B"."COMPL_GRP_TXT"="D"."COMPL_GRP_TXT" AND "B"."COMPL_ICD_CODE"<>"B"."ICD_CODE")
      17 - access("B"."ICD_CODE"="D"."ICD_9_CD")
      18 - access("A"."ICD_CODE"="B"."ICD_CODE")
      19 - filter("C"."PROC_TYPE"<>'L')
      20 - access("A"."ICD_CODE"="C"."ICD_CODE")
           filter("B"."PROC_DAY">"C"."PROC_DAY")
      21 - access("A"."ICD_CODE"="B"."ICD_CODE" AND "B"."ICD_CODE"="D"."ICD_9_CD" AND
                  "B"."COMPL_GRP_TXT"="D"."COMPL_GRP_TXT")
      25 - filter("D"."COMPL_GRP_TXT"='Reoperations')
      26 - filter("B"."COMPL_ICD_CODE"<>"B"."ICD_CODE" AND "B"."COMPL_GRP_TXT"='Reoperations' AND
                  ("B"."COMPL_ICD_CODE" LIKE '45.%' OR "B"."COMPL_ICD_CODE" LIKE '46.%' OR "B"."COMPL_ICD_CODE"
                  '48.%' OR "B"."COMPL_ICD_CODE" LIKE '49.%'))
      27 - filter("C"."PROC_TYPE"<>'L')
    Note: cpu costing is off
    61 rows selected.Please suggest any change for the query and where are the bottlenecks ?

    Same question as above:
    But how are you using the view?
    You're presumably not planning to just do a select * from view with no additional views or predicates are you?Views that are that big and resource intensive would rarely be used in just a select * from view.
    Presuambly that explain plan is from just the entire view source query or from the view actually being used in a SQL statement with further joins or predicates?
    Those statements are what you need to get execution plans from to check that you're getting a predicate pushdown, etc
    Otherwise, if the stats are accurate and the estimates are accurate and you are just doing a select * from view, where's the performance surprise?

  • How do I use the option "table view" in NetWeaver 2004s Query Designer?

    Dear,
    We have used NetWeaver 2004s Query Designer, We found a strange problem. The option to select table view is not available. It is greyed out. How can you select table view (tabular) in 2004s Query Designer?
    I have read the help doc about tabular view of NetWeaver 2004s Query Designer, I check my query, it has only one structure . but the option is still greyed out. I rebuild the query with 3.x Query Designer in tabular view, and reopen it with 2004s Query Designer, So there is a tab named "tabular view" display, but the option to select table view is still not available, and when users view the query result in web , it is still not in tabular view display. So I am confused, is there a bug with NetWeaver 2004s Query Designer?
    Please help me. Thanks!

    Note 1002271. Seach this note to use key word "table view"

  • Query using Materalized view in oracle 9i and 10g

    Hello
    There are snapshots (materialized view) used in my application. We have recently migrated from 9i to 10g release 2 database.
    After migration i have observed explain plan of query which is using materialized view and i found in 9i oracle treating materalized view as table. In 10g oracle is considerting it as MVIEW only (MAT_VIEW ACCESS BY INDEX ROWID). However in 10g cost of query which is using materialized view is much higher than 9i. And execution time is also random.
    Can anbody pls. expalin diff. of materalized view access in oracle 9i and 10g.
    Thanks

    can you post your query with explain plan for both 9i version and 10g version.
    Thanks,
    karthick.

  • Using Materialize View in a query

    Hi,
    Oracle Version 10g
    I have created 1 MV as per the below script from taking a data from diffrent schema.
    CREATE MATERIALIZED VIEW ERM_EMPLOYEE_MASTER_SYN
    REFRESH COMPLETE ON DEMAND
    START WITH TO_DATE('05-03-0012', 'DD-MM-YYYY') NEXT SYSDATE + 120/(24*60)
    AS
    SELECT "EMP_STAFFID","EMP_FIRSTNAME","EMP_LASTNAME","EMP_MIDDLENAME","EMP_LEGALNAME","EMP_COMPANYNAME","EMP_NICKNAME","EMP_SALUTATION","EMP_SUFFIX","EMP_SHIFTCODE","EMP_CALENDARCODE","EMP_MAILID","OU_ID","EMP_REPORTINGTO","EMP_FUNCTIONALREPORTINGTO","EMP_OFFICIATEID","EMP_SECRETARY" FROM HRMSADMIN.ERM_EMPLOYEE_MASTER WHERE EMP_ISACTIVE = '1' AND EMP_STAFFID NOT IN (SELECT EMP_STAFFID FROM HRMSADMIN.ERM_EMPLOYEE_MASTER WHERE TEMP_EMP_STAFFID ='TEMP')
    UNION
    SELECT "EMP_STAFFID","EMP_FIRSTNAME","EMP_LASTNAME","EMP_MIDDLENAME","EMP_LEGALNAME","EMP_COMPANYNAME","EMP_NICKNAME","EMP_SALUTATION","EMP_SUFFIX","EMP_SHIFTCODE","EMP_CALENDARCODE","EMP_MAILID","OU_ID","EMP_REPORTINGTO","EMP_FUNCTIONALREPORTINGTO","EMP_OFFICIATEID","EMP_SECRETARY
    FROM HRMSADMIN.ERM_CONTRACT_EMPLOYEES WHERE EMP_ISACTIVE = '1'
    Now when I am using the MV in a select sub query, query is taking time if I am using MV in a select statement
    like
    (SELECT (EMP_FIRSTNAME || ' ' || EMP_MIDDLENAME || ' ' ||
    EMP_LASTNAME) AS EMP_COMPANYNAME
    FROM *ERM_EMPLOYEE_MASTER_SYN* A, ASSIGNMENT_TEAMALLOCATION B
    WHERE A.EMP_STAFFID = B.TEAMMEMBER_ID
    AND B.TEAMTYPE_ID = 1
    AND B.ASSIGNMENT_ID = ASSMT.ASSIGNMENT_ID) TEAM_LEAD,
    Can you please suggest some solution how can I reduce the extraction time.
    I have tried to create a MV with Primary key but still same result
    MV has only 4000 records.
    Thanks
    Regards
    Anant

    Hello
    You need to provide more information. Have a look at the FAQ - specifically how to post a tuning request...
    SQL and PL/SQL FAQ
    David

  • Query DB2 tables from oracle using normal view

    This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?
    thanks,
    vinodh

    Vinodh2 wrote:
    This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?How can the SQL select statement via a dblink not work for a view, but the same SQL select statement work for a materialised view?
    Do you think the database link or remote database care whether the select SQL that hits it, comes from a PL/SQL procedure, a view, a materialised view, a job or whatever else? It has no idea what/who is behind that select SQL - and nor does it care.
    As for the benefits of a view vs. a materialised view - that depends on the requirements for needing to use that foreign database's data in the local database.

  • How to display the field name in the tabulated view for a content query web part

    I have added a content query web part changed the web part file to include custom columns imported and reffered itemstyle.xsl
    to include the tabulated view for the content query.
    However the way it is displayed is such that only the content is displayed.
    As i am using a tabular view wto display the data, i want to display their field names as well.

    Hi  ,
    According to your description, my understanding is that you need to display the field in the tabulated view for a content query web part.
    For your issue, please refer to the code as below:
    <xsl:template name="VendorCustomStyle" match="Row[@Style='VendorCustomStyle']" mode="itemstyle">
    <html>
    <table width="100%">
    <xsl:if test="count(preceding-sibling::*)=0">
    <tr>
    <td width="8%" valign="top"><div class="item"><b>Vendor ID</b></div></td>
    <td width="12%" valign="top"><div class="item"><b>Vendor Name</b></div></td>
    <td width="50%" valign="top"><div class="item"><b>Vendor Description</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Country</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Vendor Date</b></div></td>
    <td width="10%" valign="top"><div class="item"><b>Created By</b></div></td>
    </tr>
    </xsl:if>
    <tr>
    <td width="8%" valign="top"><div class="item"><xsl:value-of select="@VendorID" /></div></td>
    <td width="12%" valign="top"><div class="item"><xsl:value-of select="@Title" /></div></td>
    <td width="50%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Description" disable-output-escaping="yes" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Country" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Vendor_x005F_x0020_Date" /></div></td>
    <td width="10%" valign="top"><div class="item"><xsl:value-of select="@Author" /></div></td>
    </tr>
    </table>
    </html>
    </xsl:template>
    For more information, please have a look at the blog:
    http://www.codeproject.com/Articles/756834/Customizing-the-Content-Query-Web-Part-and-Item-St
    http://msdn.microsoft.com/en-us/library/ms497457.aspx
    http://clarksteveb.hubpages.com/hub/Customized-Content-Query-Web-Part-CQWP-in-SharePoint-2007-with-results-Tabbed-Grouped-and-in-an-HTML-Table
    http://blog.sharepointexperience.com/customitemstyle/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • XMLQuery starts using XMLSEQUENCEFROMXMLTYPE when adding filter to query

    Hi,
    I'm creating a single XML view on 3 relational tables. These table represent:
    1. a dataset description (table: refs)
    2. a keyset (table: keyset, a table with between refs )
    3. a data set (table: data, consisting of reference to key, value, and reference to a dataset)
    Per dataset I can have multiple keys, per key I have multiple values
    (1:N for dataset:keys, 1:N keys:values)
    The definition is given below:
    DROP TABLE data;
    DROP TABLE refs;
    DROP TABLE keyset;
    CREATE TABLE data (ref int, key int, value float);
    CREATE TABLE refs (ref int);
    CREATE TABLE keyset (key int, ref int);
    CREATE INDEX data_krv ON data (key,ref,value);
    CREATE INDEX keyset_kr ON keyset (key,ref);
    INSERT INTO refs VALUES (1);
    INSERT INTO refs VALUES (2);
    INSERT INTO data VALUES (1,1,1.5);
    INSERT INTO data VALUES (1,1,2.5);
    INSERT INTO data VALUES (1,2,3.5);
    INSERT INTO data VALUES (1,2,4.5);
    INSERT INTO data VALUES (2,1,5.5);
    INSERT INTO data VALUES (2,1,6.5);
    INSERT INTO data VALUES (2,2,7.5);
    INSERT INTO data VALUES (2,2,8.5);
    INSERT INTO keyset SELECT DISTINCT key, ref FROM data;
    CREATE OR REPLACE VIEW drk_xml_view OF XMLType
    with OBJECT ID
      extract(object_value,'/ref').getnumberval()
    AS
    SELECT xmlElement(
         "ref",
         xmlElement("ref_id", refs.ref),
         (SELECT xmlAgg(
                    xmlElement("key",
                      xmlElement("key_id",keyset.key),
                      xmlElement("values",
                          (SELECT xmlAgg(xmlElement("value",data.value))
                           FROM data
                           WHERE data.key=keyset.key AND data.ref=keyset.ref)
          FROM keyset WHERE refs.ref = keyset.ref
    ) FROM refs
    /When I do a query like:
    SELECT xmlQuery('for $i in /ref return max($i/key/values/value)' passing object_value returning content) from drk_xml_view;the explain plan looks as expected:
    | Id  | Operation              | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |           |     2 |    26 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE        |           |     1 |    65 |            |          |
    |   2 |   NESTED LOOPS         |           |     1 |    65 |     6   (0)| 00:00:01 |
    |*  3 |    INDEX FAST FULL SCAN| KEYSET_KR |     1 |    26 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN    | DATA_KRV  |     1 |    39 |     3   (0)| 00:00:01 |
    |   5 |  SORT AGGREGATE        |           |     1 |       |            |          |
    |   6 |   FAST DUAL            |           |     1 |       |     2   (0)| 00:00:01 |
    |   7 |  TABLE ACCESS FULL     | REFS      |     2 |    26 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("KEYSET"."REF"=:B1)
       4 - access("DATA"."KEY"="KEYSET"."KEY" AND "DATA"."REF"=:B1)
           filter("DATA"."REF"="KEYSET"."REF")
    Note
       - dynamic sampling used for this statementThis is very nicely optimized.
    But now I do this one:
    SELECT xmlQuery('for $i in /ref[./ref_id<2] return max($i/key/values/value)' passing object_value returning content) from drk_xml_view;(where I only added a constraint on the /ref/ref_id) the following occurs:
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        |     2 |    26 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                    |                        |     1 |     2 |            |          |
    |   2 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |          |
    |   3 |  SORT AGGREGATE                    |                        |     1 |       |            |          |
    |*  4 |   FILTER                           |                        |       |       |            |          |
    |   5 |    FAST DUAL                       |                        |     1 |       |     2   (0)| 00:00:01 |
    |   6 |  TABLE ACCESS FULL                 | REFS                   |     2 |    26 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - filter(:B1<2)
    Note
       - dynamic sampling used for this statementSo, it doesn't use any index any more and creates a XMLSequenceFromXMLType instead. This one is then parsed which results in really bad performance.
    I've tried to add extra indexes to the tables, but that didn't result in an optimilization. From a SQL point of view this seems quite easy, but using the view it gives me problems.
    Is there someone who can explain me what is happening here? Or give me some pointers?
    Please let me know if you need to know more, or if something is unclear.
    Best regards

    SQL> SELECT xmlQuery('for $i in /ref where $i/ref_id < 2 return max($i/key/values/value) ' passing object_value returning content)
      2    from drk_xml_view
      3  /
    XMLQUERY('FOR$IIN/REFWHERE$I/REF_ID<2RETURNMAX($I/KEY/VALUES/VALUE)'PASSINGOBJECT_VALUERETURNINGCONTENT)
    4.5
    Execution Plan
    Plan hash value: 2754328746
    | Id  | Operation           | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |        |     2 |    26 |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |        |     1 |    65 |            |          |
    |*  2 |   HASH JOIN         |        |     1 |    65 |     5  (20)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| KEYSET |     1 |    26 |     2   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| DATA   |     1 |    39 |     2   (0)| 00:00:01 |
    |   5 |  SORT AGGREGATE     |        |     1 |       |            |          |
    |*  6 |   FILTER            |        |       |       |            |          |
    |   7 |    FAST DUAL        |        |     1 |       |     2   (0)| 00:00:01 |
    |   8 |  TABLE ACCESS FULL  | REFS   |     2 |    26 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("DATA"."KEY"="KEYSET"."KEY" AND
                  "DATA"."REF"="KEYSET"."REF")
       3 - filter("KEYSET"."REF"=:B1)
       4 - filter("DATA"."REF"=:B1)
       6 - filter(:B1<2)
    Note
       - dynamic sampling used for this statement
    SQL>

  • Create a view based off a query in Access WebApp

    I'm trying to create a summary view based on a query.  The query is being used to make a simple join two tables.  I don't have an issue creating a datasheet or list view off the query, but when I try to create a summary view, I'm unable to
    create it.
    From the desktop app, I'm able to click on the plus sign to add a new view, give it a name, choose the type and select my record source.  When I click on "Add New View" nothing happens.  I do not get any progress dialog box as I do for
    other views.  The popup for the "Add New View" simply disappears.  Is this the expected behavior?
    Based on this thread I don't think so.
    https://social.msdn.microsoft.com/Forums/en-US/a5e60abc-0061-429e-8ce8-2014626c42c2/access-web-app-open-a-subform-from-a-query-based-summary-view?forum=accessdev
    Again, this is a simple query table 1 has 8 colums, all of them are simple text except for one lookup column that includes the data with the table, one column stores the a primary key from the second table.  The second table is a simple table with
    3 columns. 
    Is this a limitation of the Access Web App?

    Hi,
    You should be able to create a new summary view off a saved query. The behavior you describe sounds very odd but I’m not able to repro this on my computer. Could
    you try something for me? Try and create a new summary view and use a table as its record source. Does that get created OK?
    Jeff Conrad - Access Junkie - MVP Alumnus
    Senior Content Developer - Modern Assistance and Support Experience - Microsoft Corporation
    Author - Microsoft Access 2013 Inside Out
    Author - Microsoft Access 2010 Inside Out
    Co-author - Microsoft Office Access 2007 Inside Out
    Access 2007/2010/2013 Info: http://www.AccessJunkie.com
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/en-us/legal/Copyright/Default.aspx

  • View Criteria in ADF Query Panel with Table-Class Cast Exception

    Hi,
    I am getting Class Cast Exception when using view criteria for ADF Query Panel with Table. The version I am using is 11g Release 1(11.1.1.2.0)
    Here is what I did:
    1. created a view criteria on a view object
    2. all are optional
    3. all are Strings
    3. Dragged the view criteria as a query component (ADF Query panel with Query table) on to the design layout
    and the error when I clicked the Search button is:
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
    at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1289)
    at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at sni.foundation.facesextensions.filters.FoundationFilter.doFilter(FoundationFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4549)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4603)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
    Thanks
    Venkatesh

    Hi Frank.
    I'm using JDev 11.1.1.3.0 as you suggest the error is no longer present in the latest version.
    I can pick my query from the "Saved Search" pick list on the QueryPanel list of queries just fine, and it sets up the filter properly, but when I press the "Search" button, I get the same reported error...
    <RegistrationConfigurator><handleError> Server Exception during PPR, #1
    javax.el.ELException: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at com.sun.el.parser.AstValue.invoke(AstValue.java:161)
         at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1303)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:115)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassCastException: oracle.jbo.common.ViewCriteriaImpl cannot be cast to oracle.jbo.ViewCriteriaRow
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._clearFilterCriteriaRows(FacesCtrlSearchBinding.java:4588)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._addFilterCriteria(FacesCtrlSearchBinding.java:4642)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:424)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
         ... 42 more

  • Set view criteria on af:query choice LOV field

    i have an af:query. one of the fields is a choice. the LOV for the choice come from a VO. i need to set view criteria for the query for the LOV for the choice. that is, the query for the values of the choice requires view criteria.
    moreover, that search criteria is only known by the view. because the hooks for the choice are set up entirely in the model, i don't see how it would ever be possible to use values from the view to define the query for the LOV for the choice.
    any ideas?

    Assuming that you can have a method at the AM level that sets the viewCriteria for your VO, you can drag this method to the page flow to be executed before you go into the query page - this will set the right condition for the list that needs to populate the LOV.
    Then the query component can use that VO as an LOV like this:
    http://blogs.oracle.com/shay/2009/12/adf_query_with_parameters_and_1.html

  • Command buttons to Assign Query / Query view with variables on Workbooks

    Hi experts,
    We want to have a workbook with buttons that will change the Query/Query view displayed in the unique grid we have.
    We've included command buttons on a workbook, as "<b>Data Provider Specific Command</b>" and chose the Queries, selecting the "<b>Assign Query / Query View</b>" option.
    When using queries without variables or just SAP exit variables it works perfectly, clicking the buttons change the table displayed accordingly. But when using queries that have at least one variable, in our test to select time interval, it doesn't work anymore.
    In our test, we're using just 2 queries and they have the same input variable (to select months interval); but when clicking the button no change/error occurs.
    Any ideas?
    Thanks in advance.

    Hi,
    Here is one approach - Keep three analysis items in the WT. Assign three different data providers to all three analysis items. If you do not want to show any query when the WT first loads, don't assign any query to the data providers. When a button is pushed, you can use the command SET_DATA_PROVIDER_PARAMATERS to assign a query to a DP so that that query will show up.
    Other commands that will help you would be SET_ITEM_PARAMETERS using which you can hide analysis items and also, you can use the command BACK_TO_INITIAL_DP_STATE on data providers so that they do not show up if they were blank at the start.
    Another way to hide a query is to assign the analysis item to a data provider which is blank.
    For your requirements, you will have to put multiple commands behind each button - you can decide which of the above commands suit you best.

  • Inline views / view merge slowing the query

    I have a tool generated query. This query uses inline views. The individual view return data under a second but final query is taking 10min +. any suggestion.
    I tried /*+ NO_MERGE(D1,D2,D3,D4)*/ but to no help.
    TIA.
    SELECT /*+ NO_MERGE(D1,D2,D3,D4)*/DISTINCT d4.c5 AS c1, d2.c14 AS c2,
    d3.c8 AS c3, d2.c8 AS c4,
    d2.c9 AS c5, d2.c10 AS c6,
    d2.c11 AS c7, d2.c12 AS c8,
    d2.c13 AS c9
    FROM (vv_d1) d1,
    (vv_d2) d2,
    (vv_d3) d3,
    (vv_d4) d4
    WHERE ( NVL (d1.c1, 'q') =
    NVL (d2.c14, 'q')
    AND NVL (d1.c1, 'z') =
    NVL (d2.c14, 'z')
    AND NVL (d1.c3, 'q') =
    NVL (d2.c12, 'q')
    AND NVL (d1.c3, 'z') =
    NVL (d2.c12, 'z')
    AND NVL (d1.c6, 'q') =
    NVL (d2.c9, 'q')
    AND NVL (d1.c6, 'z') =
    NVL (d2.c9, 'z')
    AND NVL (d1.c4, 'q') =
    NVL (d2.c10, 'q')
    AND NVL (d1.c4, 'z') =
    NVL (d2.c10, 'z')
    AND NVL (d1.c5, 8) =
    NVL (d2.c13, 8)
    AND NVL (d1.c5, 9) =
    NVL (d2.c13, 9)
    AND NVL (d1.c1, 'q') =
    NVL (d4.c6, 'q')
    AND NVL (d1.c1, 'z') =
    NVL (d4.c6, 'z')
    AND NVL (d1.c1, 'q') =
    NVL (d3.c11, 'q')
    AND NVL (d1.c1, 'z') =
    NVL (d3.c11, 'z')
    AND NVL (d1.c2, 88.0) =
    NVL (d3.c9, 88.0)
    AND NVL (d1.c2, 99.0) =
    NVL (d3.c9, 99.0)
    AND NVL (d1.c3, 'q') =
    NVL (d3.c10, 'q')
    AND NVL (d1.c3, 'z') =
    NVL (d3.c10, 'z')
    AND NVL (d1.c7, 'q') =
    NVL (d2.c11, 'q')
    AND NVL (d1.c7, 'z') =
    NVL (d2.c11, 'z')
    )

    And the Oracle version number, to three decimal places is?
    Post EXPLAIN PLAN output created using dbms_xplan
    http://www.psoug.org/reference/explain_plan.html

  • Use realational operators in an SQL query??????

    does any one knows how to use realational operators in an SQL query??????
    i wud like to do something like
    select decode(2<3,sysdate,sydate +1) from dual
    but i know decode does not supports relational operators......
    thanx and Regards
    amyt

    You can use a CASE statement which does support relational operators, or if you must use DECODE, then you can use something like:
    SELECT DECODE(SIGN(2 - 3),-1,sysdate,sysdate - 1)
    FROM dual;The SIGN function returns -1 if the expression is < 0, 1 if the expression is > 0 and 0 if the expression is 0. This works for numeric comparisions. You can use the GREATEST or LEAST functions in a similar fashion for character comparisions.
    TTFN
    John

  • Sending email using PL/SQL based on a query result

    Hello all,
    I want to create a procedure using PL/SQL, based on a query result.Here is the scenario:
    I have multiple tables in Target and Source databases that I want to compare(not the whole table but queries on these tables) and if they differ, I want to shoot an email. I have some ideas how to implement this but not sure whether it is the best approach.
    select Acct_id, total from SourceTableA
    minus
    select Acct_id, total from TargetTableA
    select Acct_id, sum from SourceTableB
    minus
    select Acct_id, sum from TargetTableB
    If the result of any of above queries > 0 then I want to shoot an email and want to repeat this procedure in the morning every day.
    I know how to implement send_mail procedure using UTL_SMTP package and how to schedule tha job by dbms_job package. But I am not sure how to implement the result of minus query. In case if minus > 0 then I also want to send the name of tables in the email message where source and target tables are not same. Should i use cursor, variable or insert the result in a new table? any help would be highly appreciated. Thanks in advance.
    Khan

    Actually these queries are the part of our daily testing that we run everyday manually(after the scheduled ETL load) to see if there are any discrepencies between our datawarehouse tables and source tables. So instead of running these queries manually everyday we want to schedula a procedure that will shoot an email in case of any discrepency and indicate which tables have problems.

Maybe you are looking for

  • AP Prepayment Conversion

    Hello Guys, I need to do AP Prepayment Conversion that is to transfer Data into AP_INVOICES_ALL and AP_INVOICE_DISTRIBUTIONS_ALL tables.But the major drawback of the Payable Open Interface is that we cannot use this Open Interface for the Conversion

  • Output strings from loop into one string

    im trying my best to explain my problem so ber in mind:) hey having a bit of trouble with outputing strings from loop example i typed ab into the textbox the output should be 12 but since it is in a loop it would only output the last string and in th

  • BAPI or FUNC, MOD. to Update Date Field in Item Detail Sub-Header In PO

    Hi All, I'm working with SAP IS-Retail. In a PO, at the Item Detail, Import Tab, there are 2 sub-tabs Verif.4 and Verif. 5. This fields which are EIPO-NACD4 and EIPO-NACD5. When a new X-factory is entered for PO, this dates are deleted. I'm required

  • Sony experia Z3

    Hi all If I move from iPhone to Sony Experia Z3, will it still communicate wirelessly with my iCloud? so if I change a contact on my phone will it change in iCloud? and then in my Mac? J

  • RMI-server works on Windows and Linux but not on Solaris

    I wrote an application which uses RMI. The server is successfully tested on Windows and Linux. However it doesn't work on Solaris. Naming.lookup works, I can find the server. But calling a method on my remote interface causes a ConnectionException: j