XQuery to compare lists

Hello

I have a XML like this

< commands >

< order >

< orderid > 11 < / orderid >

< / status >

< order >

< order >

< orderid > 12 < / orderid >

< / status >

< order >

< order >

< orderid > 13 < / orderid >

< / status >

< order >

< / order >

I have to inform the present status based on the values of orderid field into another xml file and mark the status as added or rejected.

< selectedorders >

< order >

< orderid > 11 < / orderid >

< order >

< order >

< orderid > 12 < / orderid >

< order >

< / order >

IE I need

< commands >

< order >

< orderid > 11 < / orderid >

< State > added < / status >

< order >

< order >

< orderid > 12 < / orderid >

< State > added < / status >

< order >

< order >

< orderid > 13 < / orderid >

< status > deleted < / status >

< order >

< / order >

Thanks for your help.

I collect all levels of in the sequence Let's $orders: = fn:data($xml2//orderid), then check if the order is in order and update accordingly... There is no need to loop in . Exceute this xquery and let us know if you have any questions.

Tags: Fusion Middleware

Similar Questions

  • What are the differences between photo books?

    Where is there a comparative list of options in the different themes to make a photo book? Play with each theme takes a lot of time; Certainly there is a list somewhere.

    Sorry, but say no - Apple because it is certainly a valid question - http://www.apple.com/feedback/photos.html

    LN

  • VI script: get the duplicate element reference

    In the scripts of VI I copy element (any type of indicator, the constant control) with the Move method with the duplicate property - true. The top right Terminal output of the method is the reference to the source, not a new object.

    Is there a simple way to get the reference to that copy (another copy method, etc.)?

    Simple solutions not (they can work on test, but not good examples)

    1) move into temporary cluster - easy to find a new element

    (2) see all before, after and compare lists. But the source VI can be of any size and complexity.

    (3) item Create manually copy: bad, the solution should work on all types of items.

    I would use the method VI create reference in this situation.

  • Location of the .dll codec

    Hello

    Where can I find the CODEC files (for most .dll) that support Windows Media Player.
    These are the files that you see if you do this:
    Windows Media Player > help > about > Support information
    I want to copy the missing files from my office laptop for my wife. It gets audio only. AVI files. I get Audio and video of the same files.
    In both lists, I see differences, but I do not know where to copy those that she is missing.
    Both computers have Win Vista SP 2 64 bit
    Thank you

    Thanks for the reply, Halima

    I was able to determine the missing CODEC by comparing lists of codecs on both computers produced by:

    Windows Media Player > help > about > Support information

    However, I took the shotgun approach and downloaded

    XviD - 1.2.2.07062009.exe of:

    http://x-vid.org/download/?campaign=Google-PPC2

    Now I get audio and video from the laptop on. AVI files

    Frank C

  • Two system sounds may not work on the beta 4 more

    Tested my application that plays a sound system with the last update of the operating system and that they do not play.

    SystemSound.GeneralNotification
    SystemSound.SapphireNotification

    These two will not play.  Also tested with the sample application systemsound.

    I have not yet installed beta 4.  Can someone confirm if these two sounds are in beta 4?

    The file called notification_general.wav has been deleted, but the file called notification_sapphire.wav is always present on the device.

    I don't know how to really answer your question without trying it myself... I just happened to compare lists of files between beta 3 and 4 and noticed this difference and remembered seeing this topic today.

  • HttpConnection shows not all provided response header fields

    I am trying to download a file from our server via a php page.  Page specifies the header field "Content-Disposition" of value, but I cannot access the value of the HttpConnection object returned by "(HttpConnection) Connector.open ();'"  The field simply does not exist in the data of this object (I looked in the debugger).

    This field is important because it has the real path to the file I want to download (for security reasons I can not point directly to the file).  I can't change to work server from other programs that use mine, so please don't tell me which is the only option.

    Also: an other header field that is given by the page that is not displayed is 'Keep-Alive', even if I don't care this value, I just thought it was weird.

    For reference: I use Blackberry JDE 4.3.0 and 4.7 with several simulators in each IDE, all with identical results. In addition, the code generates load on my failure of device to download the files that I specify from the server, probably for the same reason.

    By the way: I know that the header fields are fed properly because I usurped the blackberry device with a user agent blackberry correctly formatted in a program on my desktop and look at the header of my page returned.

    Any ideas? Thank you.

    This could be a problem with some mobile phone operators. Some operators seek to "optimize" the HTTP traffic and can erase some headers that they do not treat as "necessary."  You can search this forum for more details. But of course, this is not the case now.

    With regard to your current case I would say you set up a sniffer (I personally use Microsoft) on your local machine and shows the traffic generated by the Simulator. In your application, you can print all available headers using getHeaderField and then compare lists.

  • Question: New user roles between Versions

    Is there any place besides the Administrator's Guide, where new user roles are listed in the annex.  I would be very happy to see a list of only the new roles available to a major version major version in the notes version or any other documentation.  Is there a way to avoid splashing and comparing list of text to the text list of the entire list of the roles of the Administrator's guide?

    We try to document all the new roles of the user in the Notes of explanation around them.  These items are usually marked with 'Necessary preliminary work' then you can quickly analyze the release notes to find them or search "[]".   PQM is available in point 6.1.1 and it includes a lot of new roles. PQM roles are documented in the Administrator's guide.

    If you want a faster way and more accurate to compare, you can get a quick list of all roles available in just looking at the roles table in the database and that comparing to the previous version.   "Select * from roles.

    Hope this helps

    Kelly

  • Is there a simple (or easier to understand) solution than this one?

    Good evening

    The problem is to identify providers who provide exactly the same set of parts as specified/selected provider. For example, given the following lines:
    SUPPLIERNAME                     PARTNAME                              QUOTE
    -------------------------------- -------------------------------- ----------
    NEW YANKEE WORKSHOP, INC.        HAMMER                                 1.89
    NEW YANKEE WORKSHOP, INC.        NAIL                                    .19
    OLD YANKEE WORKSHOP, INC.        HAMMER                                 2.09
    TOOL TIME, INC.                  HAMMER                                 1.99
    TOOL TIME, INC.                  NAIL                                     .2
    MORE TOOLS, INC.                 HAMMER                                 1.99
    MORE TOOLS, INC.                 NAIL                                     .2
    MORE TOOLS, INC.                 PLYERS                                  3.2
    HANDY TOOLS, INC.                HAMMER                                 1.99
    HANDY TOOLS, INC.                PLYERS                                   .2
    NEW YANKEE and TIME TOOL provide the same set of parts. If you choose NEW YANKEE, then the query should return TIME TOOL and vice versa. Since these are the only two suppliers who provide exactly the same pieces, choose another provider must return the empty set.

    I came up with the following solution:
    select distinct suppliername
      from quote
     where suppliername not in
           (
            --
            -- set of suppliers who supply at least one part not
            -- supplied by the specified supplier
            --
            select suppliername
              from quote
             where partname not in (
                                    select partname
                                      from quote
                                     where suppliername like '&&suppliername%'
                                   )
            union
            --
            -- set of suppliers who do not supply at least one
            -- part supplied by the specified supplier
            --
            select suppliername
              from supplier cross join
                   (
                    select partname
                      from quote
                     where suppliername like '&&suppliername%'
                   )
             where (suppliername, partname) not in (
                                                    select suppliername,
                                                           partname
                                                      from quote
                                                   )
           )
       and suppliername not like '&&suppliername%'
    ;
    that works, but feels a bit convoluted and complicated.

    The question is: Y at - it a simpler way to achieve the same result?

    Thank you very much for your help, (Note: I used 'as' in the query to save everyone - and myself - having to type the full provider name)

    John.

    DDL follows: (regardless of using varchar instead of varchar2)
    /* ------------------------------------------------------------------ */
    /* table supplier                                                     */
    
    create table supplier
      (
       suppliername         varchar(32)     not null,
       primary key(suppliername)
      );
    
    insert into supplier values
      ('NEW YANKEE WORKSHOP, INC.');
    insert into supplier values
      ('OLD YANKEE WORKSHOP, INC.');
    insert into supplier values
      ('TOOL TIME, INC.');
    insert into supplier values
      ('MORE TOOLS, INC.');
    insert into supplier values
      ('HANDY TOOLS, INC.');
    
    
    /* ------------------------------------------------------------------ */
    /* table quote                                                        */
    
    create table quote
      (
       suppliername         varchar(32)     not null,
       partname             varchar(32)     not null,
       quote                number(8,2)     not null,
       primary key(suppliername, partname),
       foreign key(suppliername) references supplier
      );
    
    insert into quote values
      ('NEW YANKEE WORKSHOP, INC.',         'HAMMER',       '1.89');
    insert into quote values
      ('NEW YANKEE WORKSHOP, INC.',         'NAIL',         '0.19');
    insert into quote values
      ('OLD YANKEE WORKSHOP, INC.',         'HAMMER',       '2.09');
    insert into quote values
      ('TOOL TIME, INC.',                   'HAMMER',       '1.99');
    insert into quote values
      ('TOOL TIME, INC.',                   'NAIL',         '0.20');
    insert into quote values
      ('MORE TOOLS, INC.',                  'HAMMER',       '1.99');
    insert into quote values
      ('MORE TOOLS, INC.',                  'NAIL',         '0.20');
    insert into quote values
      ('MORE TOOLS, INC.',                  'PLYERS',       '3.20');
    insert into quote values
      ('HANDY TOOLS, INC.',                 'HAMMER',       '1.99');
    insert into quote values
      ('HANDY TOOLS, INC.',                 'PLYERS',       '0.20');
    Published by: 440bx - 11 GR 2 on August 3, 2010 19:19 - correction of grammar, replaced 'to' by 'that '.

    Hello

    Here's one way:

    WITH     got_r_num     AS
    (
         SELECT     suppliername
         ,     partname
         ,     ROW_NUMBER () OVER ( PARTITION BY  suppliername
                             ORDER BY        partname
                           )     AS r_num
         FROM     quote
    )
    ,     got_part_list     AS
    (
         SELECT     suppliername
         ,     SYS_CONNECT_BY_PATH (partname, ',')     AS part_list
         FROM     got_r_num
         WHERE     CONNECT_BY_ISLEAF     = 1
         START WITH     r_num     = 1
         CONNECT BY     r_num          = PRIOR r_num + 1
              AND     suppliername     = PRIOR suppliername
    )
    SELECT     m.suppliername
    FROM     got_part_list     t
    JOIN     got_part_list     m     ON     t.part_list      = m.part_list
                        AND     t.suppliername     != m.suppliername
    WHERE     t.suppliername     = '&&suppliername'
    ;
    

    It is perhaps the most intuitive way. The basic procedure is exactly what you could do if you had to fix this problem manually: make a list of all parties and compare lists. The tricky part generates the list.

    In Oracle 11.2 (which I don't have available right now to test), you could simplify this using LISTAGG instead of CONNECT BY.

  • Disqualification: Compare the value list in another Table

    I'm relatively new to the Disqualification.

    I use the 11.1.1.7 version.

    I have 2 tables Oracle.  Table1.FieldA does not have a foreign key constraint (but should be) at Table2.FieldB.

    I created a snapshot for Table1 that includes FieldA.

    I created another cliché to Table2 which includes FieldB.

    I am trying to compare the Table1.FieldA with Table2.FieldB value to make sure that there is.

    I can think of a few processors that I could, but they seem to compare a value with another value in the same snapshot (table).

    Any advice would be helpful.


    Thank you.

    Ray

    Hello

    Use the search check if you want to just check between the tables. According to the reference database, you need create a list of choices on the table (can be either staged as you, or just a list of external choice provided the lookup columns are indexed). Use Lookup and return if you want to import data in the other table in your process. You can control if you want a 1:1 or from a 1:M relationship, and if you go back several records, you can use split chronogram: table with all the paintings of entry to create an intermediate join process.

    Mike

  • How to compare 2 lists of box-multi-select/shuttle APEX (e.g.1:2:3 and 3:1:2) for equality?

    I want to validate 2 selections of list of shuttle for equality. for example

    1:2:5:7:18:3

    and

    1:5:7:2:3:18

    should be treated as equals and therefore valid (i.e. same selections but in different order)

    While

    1:2:5:7:18:3

    and

    1:2:18:9 are not equal and would fail validation.

    If I use the function string_to_table() on the two lists, then I need sort the associative arrays and then compare them for equality.  Any suggestions on the best way to do it?

    Thanks in advance

    PaulP

    Thanks for all help you, but I decided to stay with string_to_table APEX tables and keep things simple.  I decided to return Varchar2 ('TRUE', 'FALSE') instead of boolean (TRUE, FALSE) so I could use the function in a SQL WHERE clause.

    Here's my working solution

    create or replace FUNCTION CheckMultiSelectStringsEqual(
          p_string1    IN VARCHAR2 ,
          p_string2    IN VARCHAR2 ,
          p_separator IN VARCHAR2)
        RETURN varchar2
    ------------------------------------------------------------------------------------------------------------------
    -- This function accepts 2 multi-select/shuttle box strings in the format '1:2:3:5:12:4'
    -- and a string separator i.e.':' and irrespective of the order of individual selections within
    -- the string, returns 'TRUE' if the strings are equal else returns 'FALSE'.
    -----------------------------------------------------------------------------------------------------------------
      IS
        l_table1 apex_application_global.vc_arr2;
        l_table2 apex_application_global.vc_arr2;
        v_return varchar2(8);
      BEGIN
        if p_string1 is null or p_string2 is null or p_separator is null then
          raise_application_error(-20001,'USAGE: CheckMultiSelectStrings() function requires 2 not null strings and a separator character' );
        end if;
        l_table1 := apex_util.string_to_table(p_string1, p_separator);
        l_table2 := apex_util.string_to_table(p_string2, p_separator);
        if l_table1.count() <> l_table2.count() then
            return 'FALSE';
        end if;
        <>
        FOR i IN 1..l_table1.count() LOOP
            FOR j IN 1..l_table2.count() LOOP
               if l_table1(i)=l_table2(j) then
                 v_return:='TRUE';
                 continue OUTER_LOOP;
               else
                 v_return:= 'FALSE';
                 continue;
               end if;
            END LOOP; -- FOR j IN 1..l_table2...
            EXIT OUTER_LOOP WHEN v_return = 'FALSE';
        END LOOP; --FOR i IN 1..l_table1.
        RETURN v_return;
      END;
    

    -= == HERE IS THE TEST FOR THE FUNCTION CODE =.

    set serveroutput on
    declare
    v_return varchar2(8);
    begin
    v_return:= CheckMultiSelectStringsEqual('1:2:3:4','2:1:3:4',':');
          if v_return='TRUE' then
              dbms_output.put_line('Strings are equal');
          else
              dbms_output.put_line('Strings are NOT equal');
          end if;
    end;
    

    Hope this helps someone...

    PaulP

  • How to compare the variables list

    Hello


    I have a requirement to compare a value in a list of values (350)


    for example:

    food ('burger', 'cake', 'sandwich'...)

    We have best practices to do?


    Thank you
    Sivakumar

    You paste the example I did for you.

    DVM Code:












    cake
    THERE


    Burger
    THERE


    chips
    THERE


    In your file attribute or xslt, you can call the digital Voltmeter using below function code.

    DVM:lookupValue1M("foods.DVM","food",bpws:getVariableData('inputVariable','payload','/client:process/client:input'),"available")

    In the above example, I kept DVM locally, you can keep it either in project MDS MDS retention is that a best practice the digital Voltmeter can be referenced from more than one composite.

    If you find the above useful, please mark this thread as response and provide marks accordingly.

    (* 7) give points - this is the right label to reward an answering machine (5 - useful; 10 - correct) points for their position if they meet your concerne.*

    Thank you
    Vijay

  • Compare 2 lists and running operation less

    Hello
    How to compare 2 lists and perform the operation with these lists less

    For ex:
    Declare
     list1 varchar2(100) := '1,2,3,4,5';
     list2 varchar2(100) := '2,3,4,5,6';
    Begin
      select list1 from dual
       minus list2 from dual
    
    end;

    Hello
    Assuming that your version of Oracle support regular expressions, this could be done like this:

    select rtrim(ltrim(regexp_substr('1,2,3,4,5', ',?[0-9]+,?',1, level), ','), ',')
    from dual
    connect by level <= length(translate('1,2,3,4,5',',0123456789', ','))+1
    minus
    select rtrim(ltrim(regexp_substr('2,3,4,5,6', ',?[0-9]+,?',1, level), ','), ',')
    from dual
    connect by level <= length(translate('2,3,4,5,6',',0123456789', ','))+1
    

    Published by: grey_narn on February 10, 2012 12:49 AM

  • By comparing the two lists for equality

    I am trying to determine if 2 lists contain the same elements, including the times, but any order. For example:

    List 1: A, B, C, D, E
    List 2: A, A, B, C, D
    List 3: A, B, D, A, C
    List 4: A, B, B, C, D

    I consider only lists 2 and 3 are equal. I have what I think are the 3 methods of work, but I'd like your opinion on:

    (1) are they really correct? Do you see an obvious flaw in the algorithm.
    (2) effectiveness. I've always aspired to look at an algorithm and be able to 'see' the big - O of it.
    (3) other ideas.

    Also, I'm a little more confidence in the accuracy of the #1 and #2 (efficiency by derogation) and less confident on #3. I had the idea of #3 the Javadoc on the playlist hashCode(). I don't really know if it's okay.
    import java.util.*;
    
    public class ListCompareTest
    {
      public static void main(String[] args)
      {
        List s1 = Arrays.asList(new String[]{"A", "B", "C", "D", "E"});
        List s2 = Arrays.asList(new String[]{"A", "A", "C", "D", "E"});
        List s3 = Arrays.asList(new String[]{"A", "E", "C", "D", "A"});
        
        System.out.println("\nUsing method 1:");
        System.out.println("s1 & s2: " + isEqual(s1, s2));
        System.out.println("s2 & s3: " + isEqual(s2, s3));
        
        System.out.println("\nUsing method 2:");
        System.out.println("s1 & s2: " + isEqual2(s1, s2));
        System.out.println("s2 & s3: " + isEqual2(s2, s3));
    
        System.out.println("\nUsing method 3:");
        System.out.println("s1 & s2: " + isEqual3(s1, s2));
        System.out.println("s2 & s3: " + isEqual3(s2, s3));
      }
      
      public static boolean isEqual(List a, List b)
      {
        if (a.size() != b.size())
        {
          return false;
        }
        
        List copyB = new ArrayList(b);
        
        for (Object obj : a)
        {
          if (! copyB.remove(obj))
          {
            return false;
          }
        }
        
        return true;
      }
      
      public static boolean isEqual2(List a, List b)
      {
        if (a.size() != b.size())
        {
          return false;
        }
        
        List copyA = new ArrayList(a);
        List copyB = new ArrayList(b);
        
        Collections.sort(copyA);
        Collections.sort(copyB);
        
        for (int i = 0; i < copyA.size(); i++)
        {
          if (! copyA.get(i).equals(copyB.get(i)))
          {
            return false;
          }
        }
        
        return true;
      }
      
      public static boolean isEqual3(List a, List b)
      {
        if (a.size() != b.size())
        {
          return false;
        }
        
        List copyA = new ArrayList(a);
        List copyB = new ArrayList(b);
        
        Collections.sort(copyA);
        Collections.sort(copyB);
        
        return copyA.hashCode() == copyB.hashCode();
      }
    }

    Approach 1:
    O(n^2), because you do actually:

    for each element in A {
      for each element in B {
    

    Approach 2:
    Never use (i) get to iterate over a list. An ArrayList is very good (iteration of o (n)), but for a LinkedList is O(n^2). Use an explicit iterator (if necessary) or a foreach loop (where possible). Or, if for some reason you really want to stay with (i) get (and I don't see why you would here), then explicitly declare it as an ArrayList.

    Method 3:
    The hashCode() method will not work. Two unequal lists can easily have the same hash code.

    Unless your lists are very large, or it is very often called, approach 1 is probably good enough, and it is the most simple. In addition, it works in all cases. Will approach 2 evolve better, but only work with classes that implement Comparable (or if you provide a comparator).

  • Need the XQuery function that compares two nodes.

    Is there a any function XQuery for the OSB 10 g which compares two nodes with a correct management of redundant namespaces?
    There is a function "" fn:deep - equality "that compares two nodes." But it fails when one node is to have redundant namespaces as an attribute.
    I need a XQuery function that compares two nodes for the same content, same child nodes and their content, the same attributes of the child nodes except the attribute xmlns for one of the node that has redundant namespaces (namespace that are already defined in the parent nodes or any unnecessary space of names).

    for example, it should treat following two equal nodes:

    < has t '1' = >
    < xmlns:ns1 b = "ns1" >
    2
    < /b >
    < /a >


    < has t '1' = >
    < b >
    2
    < /b >
    < /a >


    Above two nodes are the same attributes and content except 1st node attribute xmlns. Wise business scenario it is redundant but not bad, same case can occur and I need to take care of these scenarios.
    Please let me know about a feature or logic to treat this

    in fact the XMLs 2 you posted are different to a '2 '.

    I tried this:

    XQuery version "1.0" encoding "Cp1252";
    (: pragma type = "xs: anyType" ::))

    declare namespace xf = "http://tempuri.org/OSB%20Project%201/compare/";

    declare function:compare() xf
    {element (*)}

    Let $a: = (t = '3')(b xmlns:ns="ns") 2 (/ b) (/a)
    Let $b: = (a t = "3") (b) 2 / (b) (/a)

    return {fn:deep - equal ($a, $b)}
    };

    XF:Compare()

    and it does not work as expected, it is the additional xmlns:ns = 'ns' are ignored...
    I have real

  • By comparing the lists

    Hello

    I am trying to compare 4 lists (valuelists) and not really found an average effective still.
    My lists are e.g..
    < 4,5,8,6,3,2,7 >
    < 1,2,3,8 >
    < 8,1,2,3 >
    < 3,5,4,9,2,8 >

    I keep a list with the values that are in each of the four lists, like:

    < 2,3,8 >

    At the moment I have create a query with the first list, and then use SQL statements (see the code example) to get my result, but it seems very complicated to me. Is there an easy way in CF?

    Thanks for the tips



    SELECT
    mn_team_ID
    Of
    ak_pr_mn
    WHERE
    mn_cat_ID (#categoryIdList #)
    GROUP BY
    mn_team_ID
    HAVING
    Count (mn_cat_id) = #listlen (categoryIdList) #.

Maybe you are looking for

  • iMessage received read

    Someone know when you read their iMessage according to whether an iMessage not a SMS if you disabled "send read receipts" in your iphone message setting menu or not?

  • Live Bookmarks is not an option most?

    Using Firefox 5 on Windows 7, when I click on an RSS feed link, such as a live bookmark backup option no longer appears. Those that I saved in the past is all works well, but I just can't figure out how to record new ones.

  • Satellite A300 - switch Wifi

    Hi all I have Satellite A300 with 32 bit Vista (never reinstalled) and I have problem with Wifi. My Wifi does not work. It seems that there are only no wifi at all and no device has ever not been. I think that he is disabled, but it is disabled even

  • Lenovo ThinkPad X 220: No. Save button download printer driver

    Hello I have a new laptop to be used and I am trying to download the printer driver HP Laserjet M1120 MFP. I can find the driver on the HP site and go as far as the page "save under", but there is no button to push to save the driver on my laptop. I

  • flashing yellow light/battery 100% how to stop?

    Amber blinks when the battery is 100% short out the battery is there a way to stop this? [Moved from comments]