XPath query with out namespace is possible ?

Hi,
our system reciving xml data using the datatype xsd[b] <any/> . am sure the system will receive the data in same format[node hierarchical] but the namespace of the root element may be differ..
i want write xpath which should not be parse based on the namespace of element.
like the method setNameSpaceAware(false) in java;
will it be possible in bpel. if so how ?
i would be appreciate any help.
Thanks,
Bogi

Ahhhh - thank you for the clarification.
Regarding the expansion of variable, is there anything further needed? Reason I ask is, when I use the variable which contains the same string as when I hard code the string in the XPATH query, I do not receive the desired results - I only receive the
'VENDOR_ADVISORY' results.

Similar Messages

  • Please suggest a select query / sub query with out using any subprograms or

    source table: Three columns ORIGIN, DESTINATION,MILES
    Origin      Destination Miles
    Sydney      Melbourne      1000
    Perth      Adelaide      3000
    Canberra      Melbounre      700
    Melbourne      Sydney           1000
    Brisbane      Sydney           1000
    Perth      Darwin           4000
    Sydney      Brisbane      1000
    out put :Three columns ORIGIN, DESTINATION,MILES
    Duplicate routes are to be ignored so the output is
    Origin      Destination      Miles
    Sydney      Melbourne      1000
    Perth      Adelaide      3000
    Canberra      Melbounre      700
    Brisbane      Sydney           1000
    Perth      Darwin           4000
    Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.

    Hi,
    user9368047 wrote:
    ... Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Why? If the most efficient way to get the results you want involves using a function, why wouldn't you use it?
    Here's one way, without any functions:
    SELECT     a.*
    FROM           source_table  a
    LEFT OUTER JOIN      source_table  b  ON   a.origin          = b.destination
                                          AND  a.destination       = b.origin
                          AND  a.miles          = b.miles
    WHERE   b.origin  > a.origin    -- Not b.origin > b.origin
    OR     b.origin  IS NULL
    ;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
    Edited by: Frank Kulash on Nov 6, 2012 7:39 PM
    Corrected WHERE clause after MLVrown (below)

  • Spooling the output of a Query with out displaying the rows

    Hello All,
    Is it possible to spool the output of
    a query/dbms_output.put_line with out displaying
    the Query output on the console.
    In my case,list of rows in the output is huge, I want
    to eliminate displaying the output of query
    so that spooling will complete faster.
    Thanks in advance.
    -Srini

    You can do:
    SET TERMOUT OFFIn your script before doing the spool command.
    You will have to write your query as a .SQL script and run it from SQL*Plus in order for it to work the way you expect.
    sqlplus -s username/password @query_script.SQL

  • While Executing Query  with out giving any inputs  to selection variables

    Hi,
    While Executing Query   in the Query Designer  with out giving any inputs  to selection variables.  I got an error message  in german Language this is translating of german to English .
    In the reading of the data, mistakes appeared.  Navigation the value is contains possible "New Delhi" of feature 0CITY40 at that
    10. ten place a mistake Notification Number BRAIN 290
    This is very urgent  can you please help me .
    Thanks & regards
    Subba Reddy.

    Double click this error message it will give you more details. Post that.

  • Using xpath.evaluate(): xpath exp with multiple namespaces

    Hi,
    I have to evaluate a xpath expression with parent node and child node having different namespaces. Like : env:parent/mig:child.
    I have set the namespacecontext for the child node[i.e., for the prefix 'mig'.]
    But am getting this error :
    javax.xml.transform.TransformerException: Prefix must resolve to a namespace: env
    How can I set the namespace context for both the parent and child nodes? Or is there are any other way of doing it?
    I cant use //mig:child as the requirement needs the whole xpath expression [env:parent/mig:child] to be given as input for the xpath.evaluate() method.
    Here's the code :
    File file = new File("D:\\Backup\\XMLs\\test.xml");
    Document xmlDocument = builder.parse(file);
    XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
    xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("env", "http://xmlns.oracle.com/apps/account/1.0"));
    NodeList nodeList =
    (NodeList)xpathEvaluator.evaluate("/env:parent/mig:child", xmlDocument,
    XPathConstants.NODESET);
    xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("mig", "http://xmlns.oracle.com/apps/account/1.0"));
    Thanks in advance.

    If you want, I can help you tomorrow. Call me at my nieuwegein office or mail me at marco[dot]gralike[at]amis[dot]nl
    I have some time tomorrow, so I can help you with this. My next presentation for UKOUG will be on XML indexes strategies anyway...
    In the meantime and/or also have a look at:
    XML Howto's (http://www.liberidu.com/blog/?page_id=441) specifically:
    XML Indexing
    * Unstructured XMLIndex (part 1) – The Concepts (http://www.liberidu.com/blog/?p=228)
    * Unstructured XMLIndex (Part 2) – XMLIndex Path Subsetting (http://www.liberidu.com/blog/?p=242)
    * Unstructured XMLIndex (Part 3) – XMLIndex Syntax Dissected (http://www.liberidu.com/blog/?p=259)
    * Unstructured XMLIndex Performance and Fuzzy XPath Searches (http://www.liberidu.com/blog/?p=310)
    * Structured XMLIndex (Part 1) – Rules of Numb (http://www.liberidu.com/blog/?p=1791)
    * Structured XMLIndex (Part 2) – Howto build a structured XMLIndex (http://www.liberidu.com/blog/?p=1798)
    * Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures (http://www.liberidu.com/blog/?p=1805)
    The posts were based on Index for XML with Repeated Elements maybe that is a bit better to read than on my notepad on the internet (aka blog)
    Edited by: Marco Gralike on Oct 28, 2010 7:51 PM

  • XPath expression with multiple namespaces?

    Hello all.
    I have been scouring the forums and Google and can't seem to find anything similar to my problem.
    I have the following XML with three namespaces. Two are defined in the root element and the third is defined in the the IdSession element. To make things even more confusing, the second and third namespaces have the same prefix, 'f'.
    This is the xml:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <NamespaceTestCall xmlns="http://my.default/namespace"
    xmlns:f="http://my.second/namespace">
    ...<f:Level1>
    ......<f:IdSession xmlns:f="http://my.third/namespace">12345</f:IdSession>
    ......<Language>ENG</Language>
    ...</f:Nivel1>
    </NamespaceTestCall>
    My question is, how do I get at the IdSession element? Don't I need to create an XPath object and assign it more than one NamespaceContext?
    This is what I am doing:
    Document xmlDocument = loadXML(xmlSource);
    XPath xpathEvaluator = XPathFactory.newInstance().newXPath();
    xpathEvaluator.setNamespaceContext(new NamespaceContextProvider("a", "http://my.third/namespace"));
    ... xpathEvaluator.evaluate("//a:IdSession", ...);
    This code works but it might not return the 'IdSession' I want, since by searching like this '//a:IdSession' it is looking in the whole document. If there were another 'IdSession' somewhere else in the document with the same URI, it would be returned. I want the 'IdSession' that lives inside of 'Level1'.
    So what I would like to do is something like this:
    ... xpathEvaluator.evaluate("/*/Level1/a:IdSession", ...);
    But this does NOT work because 'Level1' has its own namespace. So what it seems like I need to do is the following:
    ... xpathEvaluator.evaluate("/*/b:Level1/a:IdSession", ...);
    Having already added the 'Level1' namespace to the XPath object, with the prefix 'b'. But unlike JDOM, there is no 'add' functionality, only 'set', meaning if you call set twice the second call overwrites the first.
    Is there anyway to do this?
    Many thanks!
    Bob

    Hello,
    Sorry, that was my bad. I should have explained that NamespaceContextProvider is nothing more than my implementation of the NamespaceContext interface. The way I did it, I simply implemented getNamespaceURI() and getPrefix(). And the constructor accepted two parameters -- prefix and URI. So my problem was that when I assigned this NamespaceContext to my XPath object it would only have one prefix and one URI.
    But I found an implementation here:
    http://www.oreillynet.com/cs/user/view/cs_msg/50304
    that instead of only having one prefix and URI uses a map. Thus its method setNamespace() adds the prefix and URi to the map, and getPrefix() and getPrefixes() retrieve them from the map.
    Now when I want to use more than one namespace I simply call setNamespace() as many times as necessary, adding a prefix and URI pair each time, and when I am done I assign it to my XPath object.
    And it works!
    Thanks for the response!
    Bob

  • Rewrite the query with out joins and group by

    Hi,
    This was an interview question.
    Table Names: bookshelf_checkout
    bookshelf
    And the join condition between these two tables is title
    We need to rewrite below query without using join condition and group by clause ?
    SELECT b.title,max(bc.returned_date - bc.checkout_date) "Most Days Out"
               FROM bookshelf_checkout bc,bookshelf b
               WHERE bc.title(+)=b.title
               GROUP BY b.title;When I was in college, I read that most of the SELECT statements can be replaced by basic SQL operations (SET OPERATORS). Now I am trying to rewrite the query with SET operators but not able to get the exact result.
    Kindly help me on this.
    Thanks,
    Suri

    Something like this?
      1  WITH books AS (
      2  SELECT 'title 1' title FROM dual UNION ALL
      3  SELECT 'title 2' FROM dual UNION ALL
      4  SELECT 'title 3' FROM dual ),
      5  bookshelf AS (
      6  SELECT 'title 1' title, DATE '2012-05-01' checkout_date, DATE '2012-05-15' returned_date FROM dual UNION ALL
      7  SELECT 'title 1' title, DATE '2012-05-16' checkout_date, DATE '2012-05-20' returned_date FROM dual UNION ALL
      8  SELECT 'title 2' title, DATE '2012-04-01' checkout_date, DATE '2012-05-15' returned_date FROM dual )
      9  SELECT bs.title, MAX(bs.returned_date - bs.checkout_date) OVER (PARTITION BY title) FROM bookshelf bs
    10  UNION
    11  (SELECT b.title, NULL FROM books b
    12  MINUS
    13* SELECT bs.title, NULL FROM bookshelf bs)
    SQL> /
    TITLE   MAX(BS.RETURNED_DATE-BS.CHECKOUT_DATE)OVER(PARTITIONBYTITLE)
    title 1                                                           14
    title 2                                                           44
    title 3Lukasz

  • How do I Ftp a XML file with out namespace attribute

    Hi All,
    How do I FTP an xml file that is validated against a schema on the ftp adapter with out the namespace attribute being added to the first and second element of the XML file.
    For example the xml looks like this when I transfer the file.
    <XML_Event xmlns="http://xmlns.oracle.com/PlannedEventSTORMRequestProcess/STORM">
    <Event_Begin xmlns="">
    <XML_File_Header>
    <Originating_System>xxx</Originating_System>
    <ID>387</ID>
    </XML_File_Header>
    </Event_Begin>
    </XML_Event>
    However I want it to be….
    <XML_Event>
    <Event_Begin>
    <XML_File_Header>
    <Originating_System>xxx</Originating_System>
    <ID>387</ID>
    </XML_File_Header>
    </Event_Begin>
    </XML_Event>
    How do i achieve this using the ftp adapter.
    Cheers

    Here is an example that will try to reach the given size in steps of 4 in quality.
    var saveFile = File(Folder.desktop + "/test");
    var fileSize = 70;
    try{
    tmpFile = File(saveFile+".jpg");
    for(var z =100;z>5;z -=4){
    SaveForWeb(tmpFile,z);
    var chkFile = File(saveFile+".jpg");
    //$.writeln(tmpFile + " qual = " + z + " Size = " +(chkFile.length/1024).toFixed(2) + "k" );
    if((chkFile.length/1024).toFixed(2) < (fileSize +1)) break;
    tmpFile.remove();
    if(!tmpFile.exists)  SaveForWeb(tmpFile,5);
    }catch(e){$.writeln(e + " - " + e.line);}
    function SaveForWeb(saveFile,jpegQuality) {
    var sfwOptions = new ExportOptionsSaveForWeb();
       sfwOptions.format = SaveDocumentType.JPEG;
       sfwOptions.includeProfile = false;
       sfwOptions.interlaced = 0;
       sfwOptions.optimized = true;
       sfwOptions.quality = Number(jpegQuality);
    activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);

  • Query with Outer Join - Infocube X Infoobject

    Hi,
    I Have an infoobject(0account) and an infocube(Ic_accounts) in a Multicube.
    I Have a Query and i need to show in this Query the accounts from infoobject(0account) that are not in infocube(ic_accounts).
    How can I do this ?
    Thanks

    Identify a KF for which there are non-zero values for all accounts in the cube.
    Create the query with Account (from MP coming from both IO and cube) and this KF. KF will have 0 values for accounts not existing in the cube. Create a condition to show only the 0 value for the KF. This should show you all the accounts in the IO which are not in the cube.

  • Dates Between Query :( with out TO_DATE.

    Greetings,
    I have a query whete in the where clause I compare a column b/w two dates. The Query looks like this,
    trunc(LAST_UPDATE_DATE) BETWEEN '22-FEB-03' AND '21-MAR-03'.
    This query doesn't fetch any records. Whereas when I use the query with a TO_DATE function it works fine. The query looks like,
    TRUNC(LAST_UPDATE_DATE) BETWEEN TO_DATE('22-FEB-03','DD-MON-YY') AND TO_DATE('21-MAR-03','DD-MON-YY')
    Ideally I can't impose this becasue the query is a generarted query by one of the reporting tools.
    Kindly Help. I really appreciated your help in this regard.
    Thanks,
    Badhri ...

    Your NLS_DATE_FORMAT is set to something other than 'DD-MON-YY'. This can be changed at a session level by executing a query
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY'
    You could also change this at an instance level, but that would likely have side-effects on other queries. One of the reasons that not having to_date can be a royal pain.
    Justin

  • Re execute query with out using a time

    Hi
    I want to refresh data in many based tables blocks automaticly with out using a timer, lest say ever 2 m refresh the data, is there is any soluation for that
    best regards

    Hi!
    If you use a timer, the mouse cursor will not move...
    But may the content of an active item get selected, if the timer elapse.
    This is just happen, if you have a form open with a running timer
    and call another form with the open_form build-in.
    When the timer in the calling form elapse, a context switch to
    the calling form occurs and when the focus come back to the called form,
    may the current-item value is getting selected. But the mouse cursor is not moving!
    May you try to requery your block with a timer and see what's happen.
    Regards

  • Problem in XPath query with namespace

    Hi All,
    Please help me on this topic.I given xml document which i have inserted into Oracle XML DB 10g R2 without registering xml schema.
    I am listing out my problem here.
    1. I need to get the value of cost element.If i have parent node duplicate
    <?xml version="1.0" ?>
    <customers xmlns="http://localhost/openuri.org" >
    <customer xmlns="http://orcl.com">
    <order>
    <ordername>Computer</ordername>
    <cost>35785638</cost>
    </order>
    <order>
    <ordername>Computer</ordername>
    <cost>35785638</cost>
    </order>
    </customer>
    </customers>
    2. The leaf node has namespace in it.How do i write query for second cost element.
    <?xml version="1.0" ?>
    <customers xmlns="http://localhost/openuri.org" >
    <customer xmlns="http://orcl.com">
    <order>
    <ordername>Computer</ordername>
    <cost>35785638</cost>
    </order>
    <order>
    <ordername>Computer</ordername>
    <cost xmlns="http://oracle.xdb.com">35785638</cost></order>
    </customer>
    </customers>
    Thanks in Advance,
    James

    set long 100000
    var xmltext clob
    begin
    :xmltext:=
    '<?xml version="1.0" ?>
    <customers xmlns="http://localhost/openuri.org" >
         <customer xmlns="http://orcl.com">
              <order>
                   <ordername>Computer</ordername>
                   <cost>35785638</cost>
              </order>
              <order>
                   <ordername>Computer</ordername>
                   <cost>35785638</cost>
              </order>
         </customer>
    </customers>';
    end;
    select rownum as "NUM"
    ,      extractvalue(value(v),'/*') as "VALUE"
    from   table(xmlsequence(extract(xmltype(:xmltext),'//customer/order/cost','xmlns="http://orcl.com"'))) v
    SQL> r
      1  select rownum as "NUM"
      2  ,      extractvalue(value(v),'/*') as "VALUE"
      3  from   table(xmlsequence(extract(xmltype(:xmltext),'//customer/order/cost','xmlns="http://orcl.com"'))) v
      4*
           NUM VALUE
             1 35785638
             2 35785638
    begin
    :xmltext:=
    '<?xml version="1.0" ?>
    <customers xmlns="http://localhost/openuri.org" >
         <customer xmlns="http://orcl.com">
              <order>
                   <ordername>Computer</ordername>
                   <cost>35785638</cost>
              </order>
              <order>
                   <ordername>Computer</ordername>
                   <cost xmlns="http://oracle.xdb.com">35785638</cost></order>
         </customer>
    </customers>';
    end;
    select extractvalue(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"')
    from dual;
    SQL> r
      1  select extractvalue(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"')
      2* from dual
    EXTRACTVALUE(XMLTYPE(:XMLTEXT),'//COST','XMLNS="HTTP://ORACLE.XDB.COM"')
    35785638
    select *
    from table(xmlsequence(extract(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"')))
    SQL> r
      1  select *
      2  from table(xmlsequence(extract(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"')))
      3*
    COLUMN_VALUE
    <cost xmlns="http://oracle.xdb.com">35785638</cost>
    select extractvalue(value(v),'/*')  "VALUE"
    from table(xmlsequence(extract(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"'))) v
    SQL> r
      1  select extractvalue(value(v),'/*')  "VALUE"
      2  from table(xmlsequence(extract(xmltype(:xmltext),'//cost','xmlns="http://oracle.xdb.com"'))) v
      3*
    VALUE
    35785638
    select *
    from table(xmlsequence(extract(xmltype(:xmltext),'//customer/order','xmlns="http://orcl.com"')))
    SQL> r
      1  select *
      2  from table(xmlsequence(extract(xmltype(:xmltext),'//customer/order','xmlns="http://orcl.com"')))
      3*
    COLUMN_VALUE
    <order xmlns="http://orcl.com">
      <ordername>Computer</ordername>
      <cost>35785638</cost>
    </order>
    <order xmlns="http://orcl.com">
      <ordername>Computer</ordername>
      <cost xmlns="http://oracle.xdb.com">35785638</cost>
    </order>

  • Tabular form from query with outer join destroys the universe!

    Well, maybe just my app...
    At any rate, what I have is a query that pulls RISKS for a project and does a reasonable outer join which joins the latest value from a RISK_HISTORY table. Values for RISK are updated and the value for RISK_HISTORY is changed and a new entry added to the RISK_HISTORY table.
    At least that's how it's supposed to be.
    I was able to do this with a report-with-a-form region by adding an extra update process to do a new insert into RISK_HISTORY but it seems that the tabular form is a bit more work.
    Here's the query I'm using:
    select * from(
    select
    r.RISK_SEQ RISK_SEQ_DISPLAY,
    r.RISK_PRIORITY,
    r.RISK_INFO,
    r.RISK_MITIGATION,
    r.ONGOING_FLAG,
    r.RISK_DATE,
    r.WEEK_GROUP_SEQ,
    r.CREATED_ON,
    r.CREATED_BY,
    r.LAST_MODIFIED_ON,
    r.LAST_MODIFIED_BY,
    rh.STATUS,
    row_number() over (partition by rh.risk_seq order by rh.last_modified_on desc) rn
    from RISK r, WEEK_GROUP w, RISK_HISTORY rh
    where w.PROJECT_SEQ=43
    and r.week_group_seq= w.week_group_seq
    and w.week_index=0
    and rh.RISK_SEQ = r.RISK_SEQ
    ) where rn = 1
    Clicking "Add Row" gets me this:
    Error in mru internal routine: ORA-20001: no data found in tabular form
    Running debug doesn't seem to expose much for me either. Is there a better tact for me to take here?
    Thanks,
    Jon

    Hi Prazy,
    using nvl also didn't solve my problem.Actually my problem is I am having a table a in which I have a column called satus, status has the values like A or I .I have one lookup called MTH_BUYSINESS_FUNCTION in which for lookup_code A I have menaing as Active and for lookup_code I meaning is Inactive.Now in table a for sttaus I have two values one A and one null Now I want to write sql which displayes the meaning for column staus.Result should be Active and null .If I am uisng 1 query which I gave u I am not able to get the 2nd row in my output.If I use 2nd query then I get duplicate rows.
    Thanks ,
    Amrit

  • Oracle query with out using self join

    hi friends,
    i have one table for exeample PERSTATUS
    pk/fK STUDENT NUMBER SUBJECT MARKS STATUS
    1 ACCOUNTS 15 RED
    1 MATHS 35 YELLOW
    1 SCINECE 45 GREEN
    2 ACCOUNTS 55 BROWN
    2 MATHS 35 YELLOW
    2 SCINECE 45 GREEN
    3 ACCOUNTS 15 RED
    3 MATHS 35 YELLOW
    3 SCINECE 45 GREEN
    i want students how status is both red and yellow so i am using self join
    i want students status is both red and yellow so i am using self join
    SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS1 FROM PERSTATUS PS ,PERSTATUS PS1
    WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER
    PS.STATUS='RED' AND PS1.STAUTS='YELLOW'
    i want students status is both RD and YELLOW AND GREEN so i am using self join( two self joinS}
    SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS,PS2.STATUS FROM PERSTATUS PS ,PERSTATUS PS1,PERSTATUS PS2
    WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER AND PS.STUDENTNUMBER-PS2.STUDENTNUMBER
    PS.STATUS='RED' AND PS1.STAUTS='YELLOW' AND PS2.STAUTUS='GREEN'
    if i require MORE STATUS then more self joins required, is there any alternative to achive this
    and if results comes in multiple rows are accepted (since with the above query result will come in single row)
    i tried to use group by (studentnumber,status) with status='red' and status='yellow'
    but it is not possible could you povidet he solution

    Hi,
    Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, and the exact results you want from that data. Explain how you get those results from that data.
    See the forum FAQ {message:id=9360002}
    Here's an example of how to post the sample data:
    CREATE TABLE     perstatus
    (       studentnumber     NUMBER
    ,     subject          VARCHAR2 (10)
    ,     marks          NUMBER
    ,     status          VARCHAR2 (10)
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (1,           'ACCOUNTS', 15,       'RED');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (1,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (1,           'SCINECE',  45,       'GREEN');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (2,           'ACCOUNTS', 55,       'BROWN');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (2,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (2,           'SCINECE',  45,       'GREEN');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (3,           'ACCOUNTS', 15,       'RED');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (3,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (3,           'SCINECE',  45,       'GREEN');You were on the right track, thinking about GROUP BY. You're interested in something about the whole group of rows that has the same studentnumber. Looking at any individual row won't tell you if that row is part of the group you're interested in or not.
    If you want to see information about the group as a whole, you can do the whole job with GROUP BY. In this case, studnetnumber is the only thing that an entire group has in common. If you wanted to see the studentnumbers that had both RED and YELLOW, that is:
    STUDENTNUMBER
                1
                3here's one way you could do it:
    SELECT       studentnumber
    FROM       perstatus
    WHERE       status     IN ('RED', 'YELLOW')
    GROUP BY  studentnumber
    HAVING       COUNT (DISTINCT status) = 2  -- That is, both RED and YELLOW
    ORDER BY  studentnumber
    ;But say you wanted to see details about individuals in the group; for example, say we want to see all the columns for students that have all 3 of RED, YELLOW and GREEN, like this:
    STUDENTNUMBER SUBJECT         MARKS STATUS
                1 SCINECE            45 GREEN
                1 ACCOUNTS           15 RED
                1 MATHS              35 YELLOW
                3 SCINECE            45 GREEN
                3 ACCOUNTS           15 RED
                3 MATHS              35 YELLOWWe used the aggregate COUNT function earlier, but aggregate functions require collapsing the results down to one row per group.
    However, most of the aggregate functions, like COUNT, have analytic counterparts, that can give the same results without collapsing the result set. Here's one way to get the results above, using the analytic COUNT function:
    WITH     got_cnt          AS
         SELECT  studentnumber, subject, marks, status
         ,     COUNT ( DISTINCT CASE
                                   WHEN  status  IN ('RED', 'YELLOW', 'GREEN')
                             THEN  status
                               END
                    ) OVER (PARTITION BY  studentnumber)     AS cnt
         FROM    perstatus
    SELECT    studentnumber, subject, marks, status
    FROM       got_cnt
    WHERE       cnt  = 3
    ORDER BY  studentnumber
    ,            status
    ;

  • XPath query on multiple namespace XML document

    Hi,
    I am trying to locate an element in a WordML XML document using XPath.
    The structure looks like:
    <w:body>
         <wx:sect>
              <aml:annotation aml:id="0" w:type="Word.Bookmark.Start" w:name="DOC0000966"/>
    ...So I use the following expression "/wordDocument//body/sect" wich gives me a list with the <w:sect> nodes.
    Then I search for "annotation[@type='Word.Bookmark.Start']" starting from each <w:sect> node. This yields the <aml:annotation> elem.
    So far so good.
    Now I have to handle a second case as well.
    <w:body>
         <wx:sect>
         <w:p>
              <aml:annotation aml:id="0" w:type="Word.Bookmark.Start" w:name="DOC0000966"/>
    ...As you can see the <aml:annotation> is nested inside a <w:p> elem.
    My intention was to use the expression "//annotation[@type='Word.Bookmark.Start']"to handle both cases, but this expression does not match neither.
    I have tried several different alternatives with expressions and NamingContext implementations, none working.
    What am I missing?
    Thanks in advance,
    Mariano.

    Hello,
    I decided to remove all namespaces and prefixes from the XML document and now the expression works.
    I have chaned the following:
    DocumentBuilderFactory is now namespace aware (it isn't by default).
              DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
              builderFactory.setNamespaceAware(true);I picked this NamespaceContext implementation from JAXP 1.4 samples and mapped all prefixes and namespaces coming inside the XML.
              NamespaceContextImpl ns = new NamespaceContextImpl();
              ns.bindPrefixToNamespaceURI("aml", "http://schemas.microsoft.com/aml/2001/core");
              ns.bindPrefixToNamespaceURI("dt", "uuid:C2F41010-65B3-11d1-A29F-00AA00C1488");
              ns.bindPrefixToNamespaceURI("o", "urn:schemas-microsoft-com:office:office");
              ns.bindPrefixToNamespaceURI("sl", "http://schemas.microsoft.com/schemaLibrary/2003/core");
              ns.bindPrefixToNamespaceURI("v", "urn:schemas-microsoft-com:vml");
              ns.bindPrefixToNamespaceURI("w", "http://schemas.microsoft.com/office/word/2003/wordml");
              ns.bindPrefixToNamespaceURI("w10", "urn:schemas-microsoft-com:office:word");
              ns.bindPrefixToNamespaceURI("wx", "http://schemas.microsoft.com/office/word/2003/auxHint");
              XPathFactory xpathFactory = XPathFactory.newInstance();
              XPath xpath = xpathFactory.newXPath();
              xpath.setNamespaceContext(ns);Finally, I prefixed all elements in xpath expressions.
    "//aml:annotation[@w:type='Word.Bookmark.Start']"Happier now,
    Mariano.

Maybe you are looking for