Who to query and join nested elements

I have a table that contains a XMLTYPE Field. How do I query and join nested elements. For example I have a schema that has a PerstrenList element that holds one or more Perstren nodes.  The Perstren node will contain a RemarksList node that can contain one or more Remarks nodes.  My goal is to query all of the Remarks and join them with the information in it's parent node. Without the parent node information the remark is meaningless.  Following is a example document and desire result set. I know how to query the Perstren or the Remarks I just can not figure out how to marry the two. The query should only return the remarks joined with the parent information.
<RasDataSet>
   <PerstrenList>
        <Perstren>
           <TPERS>A</TPERS>
           <DEPLY>B</DEPLY>
           <STRUC>5</STRUC>
           <RemarksList>
               <REMARK>
                    <LABEL>ABC</LABEL>
                    <GENTEXT>Hello world</GENTEXT>
               </REMARK>
               <REMARK>
                    <LABEL>XYZ</LABEL>
                    <GENTEXT>Oracle XML</GENTEXT>
               </REMARK>
           <RemarksList>
        </Perstren>
        <Perstren>
       <TPERS>C</TPERS>
       <DEPLY>D</DEPLY>
       <STRUC>4</STRUC>
       <RemarksList>
           <REMARK>
                <LABEL>EFG</LABEL>
                <GENTEXT>Database</GENTEXT>
           </REMARK>
       <RemarksList>
        </Perstren>
        <Perstren>
       <TPERS>E</TPERS>
       <DEPLY>F</DEPLY>
       <STRUC>3</STRUC>
        </Perstren>       
   <PerstrenList>
</RasDataSet>
desired Results
TPERS  DEPLY   LABEL  GENTEXT
A       B       ABC   Hello World
A       B       XYZ   Oracle XML
C       D       EFG   Database
select uic,
        extractvalue(Column_value,'/Perstren/TPERS') as TPERS,
        extractvalue(Column_value,'/Perstren/DEPLY') as DEPLY,
        extractvalue(Column_value,'/Perstren/SECUR') as SECUR,
        extractvalue(Column_value,'/Perstren/STRUC') as STRUC,
        extractvalue(Column_value,'/Perstren/TIME') as TIME,
        extractvalue(Column_value,'/Perstren/AUTH') as AUTH,
        extractvalue(Column_value,'/Perstren/ASGD') as ASGD,
from test_ref doc,
    table(XMLSequence(extract(doc.XML_DOC,'/RasDataSet/PerstrenList/Perstren'))) per
[pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Sorry my Pre tag was in the wrong place Text reads:
I have a table that contains a XMLTYPE Field. How do I query and join nested elements. For example I have a schema that has a PerstrenList element that holds one or more Perstren nodes. The Perstren node will contain a RemarksList node that can contain one or more Remarks nodes. My goal is to query all of the Remarks and join them with the information in it's parent node. Without the parent node information the remark is meaningless. Following is a example document and desire result set. I know how to query the Perstren or the Remarks I just can not figure out how to marry the two. The query should only return the remarks joined with the parent information.
Sorry my Pre tag was in the wrong place

Similar Messages

  • Select Query and Join Between int and Numeric(22)

    I have two tables
    tablea
    Field1 int
    tableb
    Field1 Numeric(22)
    I know this design is wrong but this is what I have ?
    tablea contains about 12M records
    Field1 in tablea is one to one related to Field1 in tableb
    Now I have Select Query
    Select tablea.* from tablea,tableb where tablea.field1=tableb.field1 and tableb.field2 > somrthing
    Query here is
    Does Join Between
    int type

    Yes, avinash said rightly.
    there is another way bit diffict.
    use the indexes properly as available in the mseg table and mkpf table even then it is diffcult
    else try using BAPI.
    some bapi will give the entire details of the MATERAIL DOCUMENT
    go to BAPI explorer tcode BAPI.
    where you can find the BAPI name like the 'GET_LIST'.
    Try this.
    hope this will serve your purpose.
    Thanks and regards
    Ramchander Rao.K

  • Select query and join's

    Hi All,
    I had to modify the current select query coz its taking a lot of database time, please suggest the best solution for the below.
    SELECT msegbukrs mkpfbudat mkpf~bldat
    msegebeln mkpfxblnr mseg~mblnr
    msegmjahr msegzeile mseg~xauto
    msegparent_id msegwerks mseg~umwrk
    msegumlgo msegparent_id ekko~reswk
    msegwerks mseglgort mseg~matnr
    msegerfmg msegerfme mseg~shkzg
    msegsjahr msegsmbln mseg~smblp
    msegcharg ekkobedat
    INTO TABLE g_tbl_main
    FROM mkpf JOIN mseg
    ON mkpfmandt = msegmandt AND
    mkpfmblnr = msegmblnr AND
    mkpfmjahr = msegmjahr
    JOIN ekko ON msegmandt = ekkomandt AND
    msegebeln = ekkoebeln
    JOIN likp  ON mkpfxblnr = likpvbeln
    CLIENT specified
    WHERE mkpf~mandt = sy-mandt AND
    mkpf~budat IN s_budat AND
    ekko~bedat IN s_bedat AND
    mseg~ebeln IN s_ebeln AND
    mkpf~xblnr IN s_vbeln AND
    likp~vstel IN s_vstel AND
    ekko~reswk IN s_reswk AND
    mseg~werks IN r_werks AND
    mseg~lgort IN s_lgort AND
    mseg~matnr IN s_matnr AND
    mseg~smbln = space AND
    mseg~bwart IN s_bwart AND
    mseg~kzzug = c_true.

    Yes, avinash said rightly.
    there is another way bit diffict.
    use the indexes properly as available in the mseg table and mkpf table even then it is diffcult
    else try using BAPI.
    some bapi will give the entire details of the MATERAIL DOCUMENT
    go to BAPI explorer tcode BAPI.
    where you can find the BAPI name like the 'GET_LIST'.
    Try this.
    hope this will serve your purpose.
    Thanks and regards
    Ramchander Rao.K

  • Need complex query  with joins and AGGREGATE  functions.

    Hello Everyone ;
    Good Morning to all ;
    I have 3 tables with 2 lakhs record. I need to check query performance.. How CBO rewrites my query in materialized view ?
    I want to make complex join with AGGREGATE FUNCTION.
    my table details
    SQL> select from tab;*
    TNAME TABTYPE CLUSTERID
    DEPT TABLE
    PAYROLL TABLE
    EMP TABLE
    SQL> desc emp
    Name
    EID
    ENAME
    EDOB
    EGENDER
    EQUAL
    EGRADUATION
    EDESIGNATION
    ELEVEL
    EDOMAIN_ID
    EMOB_NO
    SQL> desc dept
    Name
    EID
    DNAME
    DMANAGER
    DCONTACT_NO
    DPROJ_NAME
    SQL> desc payroll
    Name
    EID
    PF_NO
    SAL_ACC_NO
    SALARY
    BONUS
    I want to make  complex query  with joins and AGGREGATE  functions.
    Dept names are : IT , ITES , Accounts , Mgmt , Hr
    GRADUATIONS are : Engineering , Arts , Accounts , business_applications
    I want to select records who are working in IT and ITES and graduation should be "Engineering"
    salary > 20000 and < = 22800 and bonus > 1000 and <= 1999 with count for males and females Separately ;
    Please help me to make a such complex query with joins ..
    Thanks in advance ..
    Edited by: 969352 on May 25, 2013 11:34 AM

    969352 wrote:
    why do you avoid providing requested & NEEDED details?I do NOT understand what do you expect ?
    My Goal is :
    1. When executing my own query i need to check expalin plan.please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_9010.htm#SQLRF01601
    2. IF i enable query rewrite option .. i want to check explain plan ( how optimizer rewrites my query ) ? please proceed to do so
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#PFGRF009
    3. My only aim is QUERY PERFORMANCE with QUERY REWRITE clause in materialized view.It is an admirable goal.
    Best Wishes on your quest for performance improvements.

  • Need help in optimizing the query with joins and group by clause

    I am having problem in executing the query below.. it is taking lot of time. To simplify, I have added the two tables FILE_STATUS = stores the file load details and COMM table that is actual business commission table showing records successfully processed and which records were transmitted to other system. Records with status = T is trasnmitted to other system and traansactions with P is pending.
    CREATE TABLE FILE_STATUS
    (FILE_ID VARCHAR2(14),
    FILE_NAME VARCHAR2(20),
    CARR_CD VARCHAR2(5),
    TOT_REC NUMBER,
    TOT_SUCC NUMBER);
    CREATE TABLE COMM
    (SRC_FILE_ID VARCHAR2(14),
    REC_ID NUMBER,
    STATUS CHAR(1));
    INSERT INTO FILE_STATUS VALUES ('12345678', 'CM_LIBM.TXT', 'LIBM', 5, 4);
    INSERT INTO FILE_STATUS VALUES ('12345679', 'CM_HIPNT.TXT', 'HIPNT', 4, 0);
    INSERT INTO COMM VALUES ('12345678', 1, 'T');
    INSERT INTO COMM VALUES ('12345678', 3, 'T');
    INSERT INTO COMM VALUES ('12345678', 4, 'P');
    INSERT INTO COMM VALUES ('12345678', 5, 'P');
    COMMIT;Here is the query that I wrote to give me the details of the file that has been loaded into the system. It reads the file status and commission table to show file name, total records loaded, total records successfully loaded to the commission table and number of records that has been finally transmitted (status=T) to other systems.
    SELECT
        FS.CARR_CD
        ,FS.FILE_NAME
        ,FS.FILE_ID
        ,FS.TOT_REC
        ,FS.TOT_SUCC
        ,NVL(C.TOT_TRANS, 0) TOT_TRANS
    FROM FILE_STATUS FS
    LEFT JOIN
        SELECT SRC_FILE_ID, COUNT(*) TOT_TRANS
        FROM COMM
        WHERE STATUS = 'T'
        GROUP BY SRC_FILE_ID
    ) C ON C.SRC_FILE_ID = FS.FILE_ID
    WHERE FILE_ID = '12345678';In production this query has more joins and is taking lot of time to process.. the main culprit for me is the join on COMM table to get the count of number of transactions transmitted. Please can you give me tips to optimize this query to get results faster? Do I need to remove group and use partition or something else. Please help!

    I get 2 rows if I use my query with your new criteria. Did you commit the record if you are using a second connection to query? Did you remove the criteria for file_id?
    select carr_cd, file_name, file_id, tot_rec, tot_succ, tot_trans
      from (select fs.carr_cd,
                   fs.file_name,
                   fs.file_id,
                   fs.tot_rec,
                   fs.tot_succ,
                   count(case
                            when c.status = 'T' then
                             1
                            else
                             null
                          end) over(partition by c.src_file_id) tot_trans,
                   row_number() over(partition by c.src_file_id order by null) rn
              from file_status fs
              left join comm c
                on c.src_file_id = fs.file_id
             where carr_cd = 'LIBM')
    where rn = 1;
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS
    LIBM    CM_LIBM.TXT          12345678                5          4          2
    LIBM    CM_LIBM.TXT          12345677               10          0          0Using RANK can potentially produce multiple rows to be returned though your data may prevent this. ROW_NUMBER will always prevent duplicates. The ordering of the analytical function is irrelevant in your query if you use ROW_NUMBER. You can remove the outermost query and inspect the data returned by the inner query;
    select fs.carr_cd,
           fs.file_name,
           fs.file_id,
           fs.tot_rec,
           fs.tot_succ,
           count(case
                    when c.status = 'T' then
                     1
                    else
                     null
                  end) over(partition by c.src_file_id) tot_trans,
           row_number() over(partition by c.src_file_id order by null) rn
    from file_status fs
    left join comm c
    on c.src_file_id = fs.file_id
    where carr_cd = 'LIBM';
    CARR_CD FILE_NAME            FILE_ID           TOT_REC   TOT_SUCC  TOT_TRANS         RN
    LIBM    CM_LIBM.TXT          12345678                5          4          2          1
    LIBM    CM_LIBM.TXT          12345678                5          4          2          2
    LIBM    CM_LIBM.TXT          12345678                5          4          2          3
    LIBM    CM_LIBM.TXT          12345678                5          4          2          4
    LIBM    CM_LIBM.TXT          12345677               10          0          0          1

  • Question about xml schemas and the use of unqualified nested elements

    Hello,
    I have the following schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns="http://xml.netbeans.org/examples/targetNS"
        targetNamespace="http://xml.netbeans.org/examples/targetNS"
        elementFormDefault="unqualified">
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="age" type="xsd:int"/>
        <xsd:element name="person">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element ref="name"/>
                    <xsd:element ref="age"/>
                   <xsd:element name="height" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
    </xsd:schema>I am just wondering why would someone have a nested element that is unqualified? here the "height" element.
    Can anyone explain this to me please?
    Thanks in advance,
    Julien.
    here is an instance xml document
    <?xml version="1.0" encoding="UTF-8"?>
    <person xmlns='http://xml.netbeans.org/examples/targetNS'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:schemaLocation='http://xml.netbeans.org/examples/targetNS file:/E:/dev/java/XML/WebApplicationXML/web/newXMLSchemaThree.xsd'>
    <name>toto</name>
    <age>40</age>
    <height>180</height>
    </person>

    Don't worry about it.
    There are two different styles of schemas. In one style, you define the elements, attributes, etc. at the top, and then use the "ref" form to refer to them. (I call this the "global" style.) The other style is to define elements inline where they are used. ("local" style)
    Within some bounds, they work the same and which you use is a choice of you and the tools that generate the schemas.
    A warning about the local style. It is possible to define an element in two different locations in the schema that are different. It will get past all schema validation, but it seems wrong to my sense of esthetics. With the global style, this will not happen.
    So, how did this happen? Probably one person did the schema when it only had a name and age. Then, someone else added the height element. They either used a different tool, or preferred the other style. I'm aware of no difference in the document you have described between the two styles.
    Dave Patterson

  • Query to get a listing of all folders and joins in EUL

    If anybody has a query that provides a listing of all folders and joins between those folders in a Discoverer EUL, can you please share it.
    Any help would be greatly appreciated.

    Hi
    As Rod commented you won't get an accurate listing going through XREFS. You need to look in the statistics table, EUL5_QPP_STATS where you will find a history of all worksheets that have been executed. Unfortunately the item columns in EUL5_QPP_STATS are encoded so you will need some special SQL to uncode them.
    First of all you will need to have installed the EUL extensions which can be found in the script called EUL5.SQL (located in the Discoverer\Util folder where Admin is installed) when logged in as the owner of the EUL. Theh try running this script, altering the data switch to a suitable date:
    SELECT
    QS.QS_DOC_OWNER    USER_NAME,
    QS.QS_DOC_NAME     WORKBOOK,
    QS.QS_DOC_DETAILS  WORKSHEET,
    TRUNC(QS.QS_CREATED_DATE) EXECUTION_DATE,
    *(LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 ITEMS,*
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),1,  6)) ITEM1,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),10, 6)) ITEM2,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),19, 6)) ITEM3,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),28, 6)) ITEM4,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),37, 6)) ITEM5,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),46, 6)) ITEM6,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),55, 6)) ITEM7,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),64, 6)) ITEM8,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),73, 6)) ITEM9,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),82, 6)) ITEM10,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),91, 6)) ITEM11,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),100,6)) ITEM12,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),109,6)) ITEM13,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),118,6)) ITEM14,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),127,6)) ITEM15,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),136,6)) ITEM16,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),145,6)) ITEM17,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),154,6)) ITEM18,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),163,6)) ITEM19,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),172,6)) ITEM20
    FROM
    EUL5_QPP_STATS QS
    WHERE
    *(LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 < 21*
    AND QS.QS_CREATED_DATE > '01-JAN-2009'
    Best wishes
    Michael

  • How to display query variable in text element and format the text element

    Hi All,
    I want to display the value of the value of variable against fiscper3 and the value of the variable against 0fiscyear in the web application template from the query in the text element in the web template in BI 7 Web application designer.
    Also, in the web application designer I need to format the text element in the web application designer to set the text element to center the display change the size and make it bold. I am bit lost I cannot find these properties in the web application designer against the text element.
    Appreciate if you could kindly help.
    Thanks
    Karen

    Hi
    hope below tags would help you
    Re: Search by text on a variable
    Re: Need to display text part of TEXT variable in query designer
    regards
    nag

  • Isssue when collecting the transport request for a query and its elements

    Dear All,
    When collecting a query and its elements, only the query is getting collected in to the request and not the elements and I an error is getting displayed as You can not use request xxxxx and elements could not be saved. This is in bw 3.5.
    Can anyone suggest?
    Regards,
    Ram

    Hi,
    In the transport connection make sure that all the elements for the query which you need are manually checked.
    Just drop down the menu and see the elements of the query and check if they all are selected or not.
    Here you can also see if the elements are already present in some other TR.
    Just delete all those TR's before creating this new TR.So that these objects are unlocked or it will not added to your new TR niether it will give an error.
    Also make sure that all the elements have same data package and none of the query elements are assigned to temp package or any other package.
    Once you are sure that all the elements are checked and above told issues are corrected then only create the transport and release them.
    Thanks
    Ajeet

  • Different Between In and Join Function of Query

    Hi Team,
    I have confuse for the below query getting different count.
    Version DB :-
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Query:-1
    Getting Count :-3917
    SELECT COUNT (*)
      FROM stg_ser_level_inv_db a, map_stg_gsm_serv b
    WHERE a.account_number_v IN (SELECT account_number_v
                                    FROM map_transaction_number MAP
                                   WHERE MAP.trans_type_v IN ('F', '4'))
       AND a.trans_num_v
                        IN (SELECT trans_num_v
                              FROM map_transaction_number MAP
                             WHERE MAP.trans_type_v IN ('F', '4'))
       AND a.trans_type_v
                         IN (SELECT trans_type_v
                               FROM map_transaction_number MAP
                              WHERE MAP.trans_type_v IN ('F', '4'))
       AND a.acct_no = b.stg_account_number
       AND a.serv_account_number_v= b.stg_serv_link_code
       AND NOT EXISTS (
              SELECT 1
                FROM cb_sub_ar_ap ar
               WHERE ar.account_link_code_n = b.ab_serv_acc_link_code
                 AND ar.bill_cleared_flg_v = 'N'
                 AND ar.trans_num_v IN (SELECT target_trans_num_v
                                          FROM map_transaction_number MAP
                                         WHERE MAP.trans_type_v IN ('F', '4')))--3917why when u IN condition and join condition count is different. please let me know why?
    Thanks for advance ...
    Second :-2 Join Condition
    Total Count :-789948
    select COUNT(*)
        FROM STG_SER_LEVEL_INV_DB A , MAP_STG_GSM_SERV B,MAP_TRANSACTION_NUMBER ARAP_CUR
    WHERE  A.ACCOUNT_NUMBER_V = ARAP_CUR.ACCOUNT_NUMBER_V
    AND A.TRANS_NUM_V  = ARAP_CUR.TRANS_NUM_V
    AND A.TRANS_TYPE_V = ARAP_CUR.TRANS_TYPE_V
    AND A.ACCT_NO = B.STG_ACCOUNT_NUMBER
    and a.SERV_ACCOUNT_NUMBER_V  = B.STG_SERV_LINK_CODE
    and ARAP_CUR.TRANS_TYPE_V in ('F','4')
    and not exists (select 1 from CB_SUB_AR_AP ar
          where ar.account_link_code_n = B.AB_SERV_ACC_LINK_CODE
          and AR.BILL_CLEARED_FLG_V = 'N'
          and ar.trans_num_v = ARAP_CUR.TARGET_TRANS_NUM_V);---789948

    Hi,
    Whenever you have a problem, please post a complete test script that people can run to re-create the problem and test their ideas. Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data. In this case, data that produced no more than 10 rows of output for each query should be plenty.
    Simplify the problem as much as possible. For example, it looks like both your queries are joining tables a and b the same way. Why not pretend that you have only 1 table, ab, that is the same as the result set of joining a and b? Post CREATE TABLE and INSERT statements for the relevant columns of ab.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    There are several differences between those two queries.
    For one thing, Query 1 is doing a 2-way join between a and b, and then filtering that result set by comparing it to another table (let's call it map). So if a contains 5 rows and b contains 2 rows, the result set will contain at most 5 * 2 = 10 rows. Perhaps only 8 of those 10 rows will have matching rows in map. Note that the number of rows in map, or how many rows in map match rows in a or b doesn't matter. Query 2, on the other hand, is doing a 3-way join of a, b and map, so if map has 100 rows, the result set could have as many as
    (5 * 2) * 100 = 1000 rows. We know that it won't have that many rows, because only 8 out the rows from the a-b join have matching rows in map, but the result set of the 3-way join could still have as many as
    (8) * 100 = 800 rows.
    Since you didn't post test versions of your tables, I'll use tables from the scott schema to illustrate. Scott.dept has 4 rows, only 3 of which match rows in scott.emp, so
    SELECT  d.*
    FROM     scott.dept  d     -- tables a and b in your query play this role
    WHERE     d.deptno  IN (
                      SELECT  e.deptno
                   FROM     scott.emp  e     -- map plays this role in your query
    ;produces 3 rows of output. Exactly how many rows are in emp (that number happens to be 14) and how many of those rows match rows in dept (that happens to be 14, also) doesn't matter; all that matters in the query above is that 3 of the rows in dept have matches. However, the fact that 14 of the rows in emp have matches is important in the query bleow:
    SELECT     d.*
    FROM     scott.dept  d
    JOIN     scott.emp   e  ON  d.deptno  = e.deptno
    ;which produces 14 rows of output.
    Another differece is that Query 1 says that there are 3 conditions that relate table a to map; a given row in a will be included in the result set if any row in map meets condition 1, any row in map meets condition 2, and any row in map meets condition 3. It doesn';t matter if you have to look at 2 or 3 rows in map to meet all those conditions. Query 2 says that a row from a will be included only if there is a single row in map that meets all 3 conditions.

  • How can I convert a 680x480x2 array of values into binary and then joining adjacent elements to make a 640x480 array?

    I am obtaining data from a camera and getting 10-bit data in Labview. I want to convert the element values to binary and then join adjacent elements to create an array half the size of the original. 

    Hi cowboy,
    well 640×480 is not exactly half of 680×480×2...
    - You have to read the specs of your camera. Then you should know how to combine the values.
    - When you get 10bit values you probably need I16 datatype to store the values. Unless you also decrease the color resolution to 8 bit you are still stuck to 640×480×2 byte per image...
    - To join numbers you should have a look at the numerics->data manipulation function palette
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I need to know the user who has created/modified a SAP Bex Query and WAD

    Hi!
    I need to know the user who has created and modified a SAP Bex Query and SAP  Web Application Designer. Does it possible to know this information by a table or view?
    Best Regards
    Ramon Sanchez

    Hi,
    In BEx query, when you click "Queries" to open the query, the list of queries are displayed. Highlight the query, click on the "Properties On/Off' icon(right most on the top), you would see all the details.
    In WAD, before opening the template, click on "Properties On/Off'" icon to see the details.

  • SQL QUERY TUNING(PARTITONS AND JOIN)

    Hello
    My below query is taking very long time to execute ..here is the query and explain plan
    EXPLAIN PLAN FOR select w.ref_no,a.*
    from table1 a left outer join table2 w
    on(a.emp_id=w.emp_id)
    where a.joining_date=20090205 ;
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Pstart| Pstop |
    | 0 | SELECT STATEMENT | | 2415K| 504M| | 226K (2)| | |
    |* 1 | HASH JOIN OUTER | | 2415K| 504M| 488M| 226K (2)| | |
    |* 2 | TABLE ACCESS BY INDEX ROWID| table1 | 2415K| 460M| | 77975 (1)| | |
    |* 3 | INDEX RANGE SCAN | table1_joining_ DATE | 2441K| | | 6463 (2)| | |
    | 4 | PARTITION RANGE ALL | | 39M | 718M| | 64745 (2)| 1 | 4 |
    | 5 | TABLE ACCESS FULL | table2 | 39M | 718M| | 64745 (2)| 1 | 4 |
    table 2 has 40 million rows
    Table2 structure
    emp_id
    ref_no
    Project_id
    Partitoned on Project_id, Project_id is nowhere used on the above query
    Table1 Structure
    emp_id
    joining_date
    other columns
    Is indexed on joining_date, not partitioned
    Please advise

    The CBO has estimated that you have 2415K table1 rows where joining_date = 20090205. (By the way: is this really a number?!)
    Is this estimate accurate?
    Please add some more information:
    - Which version do you use
    - How long is "very long time"?
    - How many does your query return
    - information as described in this thread: When your query takes too long ...
    Regards,
    Rob.

  • Loop through nested elements and insert via PL/SQL

    INSERT INTO Orders(id, OrderXML) VALUES
    (S_Orders.Nextval,
    '<?xml version="1.0" encoding="utf-8" ?>
    <Order xmlns="urn:foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:foo foo-1.xsd">
    <OrderRef>BBB</OrderRef>
    <OrderDate>2005-03-29</OrderDate>
    <CustomerID>1051</CustomerID>
    <Items>
    <Item>
    <ProductID>7</ProductID>
    <Price>45.6</Price>
    <Quantity>2</Quantity>
    </Item>
    <Item>
    <ProductID>19</ProductID>
    <Price>73.5</Price>
    <Quantity>10</Quantity>
    </Item>
    </Items>
    </Order>'
    I some questions regarding index search of nested elements like,Items in the above example.
    I would like to know how I can LOOP through the Items like 1..2 LOOP
    and insert those elements(item) into one table. Order information should go in to another table.
    Can this be done with xpath and PL/SQL.
    Regards
    Ulf

    Hi Marco!
    Here's some more information:
    CREATE TABLE ITEM (ProductID NUMBER,
    Price NUMBER(8,2)
    Quantity 10 NUMBER);
    CREATE TABLE ORDER (OrderRef VARCHAR2(10),
    ORDER_DATE VARCHAR2(10),
    CUSTOMERID NUMBER);
    The main problem that I have is to create an solution that can be dynamic so that I can have for instance one order and four items in one XML.
    The second XML can have one order and 10 items.
    First I want to insert the order elements in the order table and then the items records in the item table.
    To complicate things futher my real XML have namespaces in the XML, but this I think I can handle.
    Summary: So for each order row(element) I want to traverse the Item elements and insert them to the Item table.
    Regards
    /Ulf

  • DB Adapter Query - Polling using nested select

    When polling a table to initiate a BPEL process, can I use a nested select in the expression.

    The visual expression builder does not currently support this so you need to specify the raw sql directly.
    If you use the DeletePollingStrategy there is a way you can specify the exact sql string for both the 'select' and the after read 'delete'. So if you write the where clause yourself it can contain nested selects.
    This is the readme from the new PureSQLSelect database adapter sample. Also you may want to look at the PureSQLPolling sample.
    This sample shows you how you can bypass the designer's visual where clause builder to specify arbitrarily complex sql strings for your selects.
    Like the other samples, this sample uses the basic Movies schema.
    The Steps:
    Create a basic select. Made sure it has the same name and number of input parameters as you will need for your sql string. In this case create a single input parameter and call it 'genre_param'.
    Create a trivial where clause in the wizard expression builder using genre_param. I.e. genre.like(genre_param)
    Ideally run the sample once just to make sure everything else works and to get a template SQL. The select ... FROM ... part will be the same.
    Open the toplink_mappings.xml file. Look for an element called <database-query>. There will likely only be one. A sample is presented here:
    <query-manager>
    <descriptor-query-manager>
    <existence-check>Check cache</existence-check>
    <descriptor-named-queries>
    <database-query>
    <query-name>selectByGenreSelect</query-name>
    <query-should-maintain-cache>true</query-should-maintain-cache>
    <cascade-policy>1</cascade-policy>
    <should-bind-all-parameters>undefined</should-bind-all-parameters>
    <should-cache-statement>undefined</should-cache-statement>
    <should-use-wrapper-policy>true</should-use-wrapper-policy>
    <query-timeout>0</query-timeout>
    <query-arguments>
    <string>genre_param</string>
    </query-arguments>
    <query-argument-types>
    <values>java.lang.String</values>
    </query-argument-types>
    <reference-class>PureSQLSelect.Movies</reference-class>
    <refresh-identity-map>false</refresh-identity-map>
    <cache-usage>2</cache-usage>
    <lock-mode>0</lock-mode>
    <distinct-state>0</distinct-state>
    <query-indirection>
    <in-memory-query-indirection>
    <policy>0</policy>
    </in-memory-query-indirection>
    </query-indirection>
    <main-expression>
    <expression>
    <operator-type>AND</operator-type>
    <expression-list>
    <expression>
    <operator-type>Like</operator-type>
    <first-argument>
    <argument>
    <query-key-name>genre</query-key-name>
    <outer-join>false</outer-join>
    <to-many>false</to-many>
    <argument-class>oracle.toplink.tools.workbench.expressions.QueryableArgumentRepresentation</argument-class>
    </argument>
    </first-argument>
    <second-argument>
    <argument>
    <parameter-name>genre_param</parameter-name>
    <argument-class>oracle.toplink.tools.workbench.expressions.ParameterArgumentRepresentation</argument-class>
    </argument>
    </second-argument>
    <expression-class>oracle.toplink.tools.workbench.expressions.BinaryExpressionRepresentation</expression-class>
    </expression>
    </expression-list>
    <expression-class>oracle.toplink.tools.workbench.expressions.CompoundExpressionRepresentation</expression-class>
    </expression>
    </main-expression>
    <type>oracle.toplink.queryframework.ReadAllQuery</type>
    </database-query>
    </descriptor-named-queries>
    </descriptor-query-manager>
    </query-manager>
    We want to switch this query from using a high-level expression to a pure sql string. You will remove the <main-expression> element and replace it with a <sql-string> element of your own devising.
    Your replacement should look something like this:
    <query-manager>
    <descriptor-query-manager>
    <existence-check>Check cache</existence-check>
    <descriptor-named-queries>
    <database-query>
    <query-name>selectByGenreSelect</query-name>
    <query-should-maintain-cache>true</query-should-maintain-cache>
    <cascade-policy>1</cascade-policy>
    <should-bind-all-parameters>undefined</should-bind-all-parameters>
    <should-cache-statement>undefined</should-cache-statement>
    <should-use-wrapper-policy>true</should-use-wrapper-policy>
    <query-timeout>0</query-timeout>
    <sql-string>SELECT DELETED, DIRECTOR, GENRE, LAST_UPDATED, RATED, RATING, RELEASE_DATE, RUN_TIME, SEQUENCENO, STARRING, STATUS, SYNOPSIS, TITLE, TOTAL_GROSS, VIEWER_RATING FROM MOVIES WHERE (upper(GENRE) LIKE upper(concat(concat('%', #genre_param), '%'))) ORDER BY TOTAL_GROSS desc</sql-string>
    <query-arguments>
    <string>genre_param</string>
    </query-arguments>
    <query-argument-types>
    <values>java.lang.String</values>
    </query-argument-types>
    <reference-class>PureSQLSelect.Movies</reference-class>
    <refresh-identity-map>false</refresh-identity-map>
    <cache-usage>2</cache-usage>
    <lock-mode>0</lock-mode>
    <distinct-state>0</distinct-state>
    <query-indirection>
    <in-memory-query-indirection>
    <policy>0</policy>
    </in-memory-query-indirection>
    </query-indirection>
    <type>oracle.toplink.queryframework.ReadAllQuery</type>
    </database-query>
    </descriptor-named-queries>
    </descriptor-query-manager>
    </query-manager>
    Gotchas:
    The tempation to start writing pure sql may be terrible to some, but it was intentionally left out of the wizard for good reasons. Please be wary of the following when specifying pure sql:
    -There is a way to set the pure sql string in the Mapping Workbench, but when you edit the partnerlink to refresh the toplink_mappings.xml you may get an exception due to the query being in a pure sql format. For this reason you need to manually edit the toplink_mappings.xml, and again every time your run the wizard and hit finish after that.
    -The #genre_param is a TopLink convention for writing a sql string which still takes parameters. At runtime if you enter 'Action' in the bpel console, you will see this sql:
    SELECT DELETED, DIRECTOR, GENRE, LAST_UPDATED, RATED, RATING, RELEASE_DATE, RUN_TIME, SEQUENCENO, STARRING, STATUS, SYNOPSIS, TITLE, TOTAL_GROSS, VIEWER_RATING FROM SYSTEM.MOVIES WHERE (GENRE LIKE ?)
    bind => [Action]
    The #genre_param gets replaced with the value of the input parameter genre_param.
    -When specifying pure sql you should be aware of the following:
    -maintenance issues
    -loss of database platform independence
    -The sql needs to conform with the way TopLink works. It is recommended that you do not change the SELECT ... FROM ... part of the query. TopLink's design is to read from one table at a time. If an Employee has an Address, then the Address is read with a hidden relationship query. There are two advanced TopLink features which optimize reading from multiple tables, called joinedAttribute and batchAttribute reading, but the combination of these features with raw sql was not explored here. So to avoid danger you can only really affect the top level query, and only rewrite the where clause.
    -The pure sql route does not interact with most TopLink features, especially batch reading (on by default), and can not be combined with the following:
    -LogicalDeletePollingStrategy
    -SequencingPollingStrategy (LastUpdated, LastReadId, File)
    These features extend the selection criteria at runtime.

Maybe you are looking for

  • APP-FND-00676

    I am getting APP-FND-00676 error message. The error message is as follows. APP-FND-00676: The flexfield routine FDFGDC cannot read the default reference field specified for this descriptive flexfield. The developer specified a context field (via the

  • How to display additional items from an LOV?

    Hi guys, This is bound to be a fairly common scenario, though I didn't see it in the Forum archives. The wizard-based LOV facility provides support for one display value and one return value. But how do you display a half-dozen items from the row fou

  • The Best Brightness and contrast for my monitor

    I have an acer monitor AL2016W. I managed to get it too work but the screen is too bright. What is the best brightness and contrast for it? I have a resolution of 1850 x 1250, can I safely change that on my mac mini? Thank you for yuor help.

  • Closing seperate browser after cfcontent

    Hi all, I would like to get some help on cfcontent. I use cfcontent to open a pdf in a seperate browser, which works.I have a close button on the parent window, along with other information related to the document. When I hit the close button, I woul

  • Hidding Portal Roles

    Hi all, I have successfully set up Delegated User Administration in my EP 6.0 SP15. Everything works fine, except by one detail. In the standard role assignment iView (com.sap.portal.roleAssignment), all the roles are still being displayed to the del