XPath expressions in aggreation functions behave different than I expect

Hi,
I'm having the following very simple schema:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a" type="AType" />
<xs:complexType name="AType">
<xs:sequence>
<xs:element name="b" type="BType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="BType">
<xs:sequence>
<xs:element name="c" type="CType" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CType">
<xs:all minOccurs="0">
<xs:element name="d1" type="xs:double" />
<xs:element name="d2" type="xs:double" />
<xs:element name="d3" type="xs:double" />
<xs:element name="d4" type="xs:double" />
<xs:element name="d5" type="xs:double" />
<xs:element name="d6" type="xs:double" />
</xs:all>
</xs:complexType>
</xs:schema>
Which I loaded using the following code:
declare
l_bfile bfile;
begin
l_bfile := bfilename('DIR_TEMP', 'simple.xsd');
dbms_lob.open(l_bfile);
dbms_xmlschema.registerschema('http://localhost/simple.xsd',l_bfile);
dbms_lob.close(l_bfile);
end;
Then I created the table "simple" as follows:
CREATE TABLE simple OF XMLTYPE XMLSchema "http://localhost/simple.xsd" ELEMENT "a";
And I loaded the following XML document:
<?xml version="1.0"?><a>< b>
<c><d1>0</d1></c>
<c><d1>1</d1></c>
<c><d1>2</d1></c>
<c><d1>3</d1></c>
<c><d1>4</d1></c>
<c><d1>5</d1></c>
<c><d1>6</d1></c>
<c><d1>7</d1></c>
<c><d1>8</d1></c>
<c><d1>9</d1></c>
</b></a>
Which was loaded by the following code:
DECLARE
file bfile;
charContent clob := ' ';
targetFile bfile;
charset_id number := 0;
src_offset number := 1;
dst_offset number := 1;
lang_ctx number := DBMS_LOB.default_lang_ctx;
warning number;
BEGIN
DBMS_OUTPUT.enable(10000);
file := bfilename('DIR_TEMP','simple.xml');
targetFile := file;
DBMS_LOB.fileopen(targetFile,DBMS_LOB.file_readonly);
DBMS_LOB.loadclobfromfile(charContent,targetFile,DBMS_LOB.getLength(targetFile),src_offset, dst_offset, charset_id, lang_ctx, warning);
DBMS_LOB.fileclose(targetfile);
INSERT INTO simple VALUES (xmltype(charContent));
END;
The function to be executed is the avg of d1. The solution if of course 4.5.
The following queries give the correct answer:
SELECT XMLQuery('for $i in /a return avg($i//d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg(//d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a let $t := //d1 return avg($t)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
However, when I execute any of the following expressions, they return nothing (or to be exact: an empty row):
SELECT XMLQuery('for $i in /a return avg($i/b/c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg($i//c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a return avg(//c/d1)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
SELECT XMLQuery('for $i in /a let $t := //c/d1 return avg($t)' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
I'm expecting that avg($i//c/d1) selects all d1 elements contained in a c element within the context of $i and return the average of those d1s. However, it doesn't seem to do so.
When I remove the "avg" in the last query:
SELECT XMLQuery('for $i in /a let $t := //c/d1 return $t' PASSING OBJECT_VALUE RETURNING CONTENT) FROM simple;
it does return a list of all d1 elements, as I expect. However the aggragation function doesn't return the value as expected. I've tested with more aggregation functions (eg. min, max) and all are having the same effects.
Can anyone explain me what I'm missing here, or point me to some documentation which explains it?
I'm running:
SQL*Plus: Release 10.2.0.3.0 - Production
on
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
null
Message was edited by:
Tijink

Did you also try to create the XMLSchema and the table and run the queries against that?Still, no difference for me:
michaels>  declare
   l_clob   clob
      := '<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a" type="AType" />
<xs:complexType name="AType">
<xs:sequence>
<xs:element name="b" type="BType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="BType">
<xs:sequence>
<xs:element name="c" type="CType" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CType">
<xs:all minOccurs="0">
<xs:element name="d1" type="xs:double" />
<xs:element name="d2" type="xs:double" />
<xs:element name="d3" type="xs:double" />
<xs:element name="d4" type="xs:double" />
<xs:element name="d5" type="xs:double" />
<xs:element name="d6" type="xs:double" />
</xs:all>
</xs:complexType>
</xs:schema>';
begin
   dbms_xmlschema.registerschema (schemaurl      => 'http://localhost/simple.xsd',
                                  schemadoc      => l_clob,
                                  gentypes       => false
end;
PL/SQL procedure successfully completed.
michaels>  create table simple of xmltype xmlschema "http://localhost/simple.xsd" element "a"
Table created.
michaels>  insert into simple
     values (xmltype
                ('<?xml version="1.0"?><a><b>
            <c><d1>0</d1></c>
            <c><d1>1</d1></c>
            <c><d1>2</d1></c>
            <c><d1>3</d1></c>
            <c><d1>4</d1></c>
            <c><d1>5</d1></c>
            <c><d1>6</d1></c>
            <c><d1>7</d1></c>
            <c><d1>8</d1></c>
            <c><d1>9</d1></c></b></a>'
1 row created.
michaels>  select xmlquery('for $i in /a return avg($i//d1)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg(//d1)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a let $t := //d1 return avg($t)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg($i/b/c/d1)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg($i//c/d1)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a return avg(//c/d1)' passing  object_value returning content).getnumberval() res from simple
union all
select xmlquery('for $i in /a  let $t := //c/d1 return avg($t)' passing  object_value returning content).getnumberval() res from simple
       RES
       4,5
       4,5
       4,5
       4,5
       4,5
       4,5
       4,5
7 rows selected.

Similar Messages

  • OWSM 11g in EM behaving different than documentation

    Hi everyone,
    I'm trying to get OWSM 11g working so I just installed Soa suite 11gR1(11.1.1.2.0). All I need is to attach a predefined policy to an existing web service which exists incide an EJB in an EAR application. I'm following the instructions from http://download.oracle.com/docs/cd/E12839_01/web.1111/b32511/attaching.htm#CEGDGIHD , in the session "Viewing the Policies That are Attached to a Web Service". Unfortunately I'm expecting different screens than those shown in the Manual. In the documentation the figure 8.1 shows the tabs Operations / Policies / Chart / Configuration, but in my case the same screen shows only the operations Tab, making it impossible to attach the policies I need. Here's what I see at my environment: http://img203.imageshack.us/img203/751/erroowsm.png . I don't know if I missed something but it still not works as the documentation says (figure 8.1). Please, any help will be appretiated !
    Thanks,

    Rajesh wrote:
    Is it going above 1GB ?No, current memory utilization is 503MB, but it keeps increasing. Support specialist told me it is OK for agents with large number of targets to utilize up to 1GB of memory even if I told him I have only 11 targets on this host. I do not think 11 targets is "large number" and I do not want to wait until agent will use 1GB of memory.
    You can also check MOS note :
    How To Effectively Investigate & Diagnose Grid Control Agent High Memory Utilization Issues? [ID 1092466.1]I have read this note and did not find solution for my problem and that is why I contacted Oracle Support. I think this agent is leaking memory, but Support specialist suggests reinstalling this agent on other host.
    I do not think he understands problem and that is why I looking for other opinions.

  • 3.1 IRR download CSV behaves different than 3.0.1 CSV download

    I am generating some links dynamically in the select statements for some of my reports (i.e. select decode(REGULAR_EXPRESSION_KEY,
    null,'-NO RE-',
    "a href="f?p=&APP_ID.:2:... )
    Note: I changed the example a bit so that it would display and not be interpreted...
    The download to CSV in my 3.0.1 automatically stripped this HTML out of the download to CSV.
    The CSV Download in the Interactive Reports of 3.1 did not strip the html. All of this HTML is downloaded into the CSV file.
    Is there a way to get this 3.1 Interactive download to CSV to behave the same way it worked with the 3.0.1 download to CSV?
    Thanks,
    Steve

    Hi Gurus,
    I updated one of my small apex application to use interactive report, but I also encountered this kind of
    'cannot export to CSV' problem, it is so bad, we need to export to Excel all the time! I have to give up my upgrading and remade it with classic report, though many cool stuffs with interactive report, pitty!
    Ok, I will try to use your method to work around this problem, that may give me some kind of hope.
    Hope you can improve this much more in the later release.
    Anyway, 3.1 is very cool though, but also if you can more simply the Blob founction .
    Peter

  • HTMLB iterator - listbox behaving different than dropdownlistbox

    So, my turn for a question again:
    I've read through a lot of material, all the BSP blogs (each at least once, some of them over and over again ...), searched the forum to the best I could, but I'm still facing this problem:
    In my iterator, the listbox just won't display ...
    Now, using the dropdownlistbox everything works fine (like in blog 213 from Brian), but changing to listbox comes up with that empty cell ...
    Is there some different behaviour between these two elements that I should not know about?
    Have any of you used a listbox (not dropdown) in an iterator successfully? If so, examples would be appreciated!
    Best regards,
    Max

    I have it working now.  My problem was at first that I forgot to give the ListBox a pointer to my table that holds the values.  Then while debugging I actually fixed that problem but set the listbox size to 1.  Both of these options caused an error in the Runtime_IS_Valid method and stopped all rendering.  And here I was thinking there was a problem in the output HTML. 
    I finally found it when I set a breakpoint in the DO_AT_BEGINNING method of both my listbox and my dropdown listbox.  I never hit the breakpoint in the listbox.  So after debugging all the way through to the IFUR=>D2~Render method I finally found it.  The following code does work for me now in the Render_Cell_Start method of my Iterator class:
            data listbox type ref to cl_htmlb_listbox.
            create object listbox.
            listbox->id = p_cell_id.
            GET REFERENCE OF me->i_model->iusers_values INTO listbox->table.
            listbox->nameofkeycolumn = 'key'.
            listbox->nameofvaluecolumn = 'value'.
    *       listbox->onselect = 'OnUpdateUserClick'.
            listbox->selection = get_column_value( 'BNAME' ).
            listbox->width = '100%'.
            listbox->size = '2'.
            p_replacement_bee = listbox.
            p_style = 'font-size:0.9em'.
    That just goes to show you that when something is not rendering at all, you should start with a breakpoint in the Runtime_Is_Valid method.

  • Smart Objects in CS5 behave differently than in CS4?

    I've just upgraded from CS4 to CS5, and I've noticed, what is to me, a BIG change in the way Smart Objects work.
    Imagine this simplified hypothetical scenario...
    I create a document in Illustrator, with two layers.
    On one layer would be a 800x600 solid rectangle. On another layer I'd put a small 50x50 circle.
    The import thing here is that the circle would be positioned roughly in the top-left corner in relation to the rectangle.
    I'd select both objects, go over to Photoshop, create a new 800x600 document, and paste what I've just copied into the document as a Smart Object.
    Photoshop would treat both Illustrator layers as one Smart Object of course, and they would get pasted together, and they would look exactly how they did in Illustrator - that being the circle positioned in the top left corner of the rectangle.
    Now I decide I want to hide the solid rectangle in my Smart Object, but I want to keep the circle exactly as it is now in the Photoshop document.
    So I simply double-click to edit the original Illustrator file, and then I hide the layer with the rectangle on it, save the file, close it, and go back to Photoshop.
    In CS4, the file would update to show the changes I had made, so the rectangle would disappear and only the circle would remain - and importantly, the circle would maintain its position. It would stay in the top-left corner of my Photoshop document (the rectangle still exists in the original Illustrator file, but the layer it's on is simply hidden).
    However, when I do this exact same process in CS5, when I update the Smart Object after hiding the rectangle layer in Illustrator, the Smart Object seems to ignore the rectangle that is hidden in the file, and the solitary circle that remains gets totally shifted into the centre of the 800x600 Photoshop file. So it is now no longer in the top-left corner where it was before.
    This is causing me HUGE problems, because I have painstakingly positioned many many various objects in my Illustrator files which then get shifted out of place whenever I make an adjustment!
    Is there any way to get CS5 to treat Smart Objects in the same way that CS4 did before it?

    Regards your comments above, yes I am aware of that discrepancy, but I very carefully make sure not to change the size or position of the largest object. In other words, when ALL objects on ALL layers are selected, I make sure that the OVERALL X/Y co-ordinates AND X/Y dimensions do not change between adjustments of various isolated objects.
    (I actually deliberately keep a "spare" oversized rectangle on a bottom layer to maintain overall size, and it's this layer that I normally switch off in my final Smart Object.)

  • Any idea why the sissor cut tool would behave differently than it has. It makes the cut several seconds in advance of my marker-now. Previously it was precise. Thx..

    The sissor tool is making arbitrary cuts, in areas I have not specified. I have  used this tool alot. Has previously worked as desired.
    Any idea what might be controling it to act this way?
    Thank you.

    Hi
    Snap value set to something like Bar/Beat?
    CCT

  • XPath expression for each node name

    <DATABASE>
       <TITLE>
          <LANGUAGES>SGML<LANGUAGES>
       <TITLE>
    </DATABASE>Is there a direct way of retrieving xpath expression for each node name other than iterating through each node and identifying the parent node.
    Ex:
    DATABASE
    DATABASE/TITLE
    DATABASE/TITLE/LANGUAGES

    If you set an element ID using the DOM parser you can then look it up using the ID.
    private void setElementIDNode(String tag, String IDAttribute){
            NodeList nodes = doc.getElementsByTagNameNS(docNS, tag);
            for (int i = 0; i < nodes.getLength(); i++){
                Element node = (Element)nodes.item(i);
                node.setIdAttribute(IDAttribute, true);
    Element e  = doc.getElementById(elementID);But at some point you still have to iterate through the document. I believe XML Pull Parsers are a little different but I don't have experience with them.

  • After release the release version different than debug version ????

    Hello guys,
    I am having a HUGE issue with my release build version of my application, when i run my application through eclipse it runs perfectly, however after making a release build of the application and running it behaves different than the version run from eclipse ???????? has anyone ever had this problem before and if so what can you do to prevent this behavior. thank you for any advice on this issue

    Hello,
    Certain Firefox problems can be solved by performing a ''Clean reinstall''. This means you remove Firefox program files and then reinstall Firefox. Please follow these steps:
    '''Note:''' You might want to print these steps or view them in another browser.
    #Download the latest Desktop version of Firefox from http://www.mozilla.org and save the setup file to your computer.
    #After the download finishes, close all Firefox windows (click Exit from the Firefox or File menu).
    #Delete the Firefox installation folder, which is located in one of these locations, by default:
    #*'''Windows:'''
    #**C:\Program Files\Mozilla Firefox
    #**C:\Program Files (x86)\Mozilla Firefox
    #*'''Mac:''' Delete Firefox from the Applications folder.
    #*'''Linux:''' If you installed Firefox with the distro-based package manager, you should use the same way to uninstall it - see [[Installing Firefox on Linux]]. If you downloaded and installed the binary package from the [http://www.mozilla.org/firefox#desktop Firefox download page], simply remove the folder ''firefox'' in your home directory.
    #Now, go ahead and reinstall Firefox:
    ##Double-click the downloaded installation file and go through the steps of the installation wizard.
    ##Once the wizard is finished, choose to directly open Firefox after clicking the Finish button.
    More information about reinstalling Firefox can be found [https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems?esab=a&s=troubleshooting&r=3&as=s#w_5-reinstall-firefox here].
    <b>WARNING:</b> Do not run Firefox's uninstaller or use a third party remover as part of this process, because that could permanently delete your Firefox data, including but not limited to, extensions, cache, cookies, bookmarks, personal settings and saved passwords. <u>These cannot be recovered unless they have been backed up to an external device!</u>
    Please report back to see if this helped you!
    Thank you.

  • Multiple idocs in Single Job behaves differently (RBDAPP01)

    Hi,
    How to debug the background Job for Program RBDAPP01 which already posted the Idocs in 53 status from 64.
    I wanted to analyze why multiple idocs in same job behave differently than the single idoc in a job. In case of multiple idocs in a single job i put packet size 1, but no help.
    Thanks,
    Asit Purbey.

    I found the solution, so closing this Post.

  • 'Play Full Screen' looks different than 'play'  (makes timing errors)

    In iMovie, 'Play Full Screen' behaves differently than 'Play'  Makes timing errors, cuts off the beginning of commentaries, etc.

    You can't disable tap/zoom scaling. What happens if you add a margin and disable thumbnail?
    Can you convert them to a Keynote presentation (Hype?)?
    One option would be to reduce the original video dimensions and add a frame/mask around it before adding into a book, that way when it is expanded, it sits at a smaller size. Bunch of work, maybe, so unless you have higher rez video, that may be your best option.

  • "Match Regular Expression" and "Match Pattern" vi's behave differently

    Hi,
    I have a simple string matching need and by experimenting found that the "Match Regular Expression" and "Match Pattern" vi's behave somewhat differently. I'd assume that the regular expression inputs on both would behave the same. A difference I've discovered is that the "|" character (the "vertical bar" character, commonly used as an "or" operator) is recognized as such in the Match Regular Expression vi, but not in the Match Pattern vi (where it is taken literally). Furthermore, I cannot find any documentation in Help (on-line or in LabVIEW) about the "|" character usage in regular expressions. Is this documented anywhere?
    For example, suppose I want to match any of the following 4 words: "The" or "quick" or "brown" or "fox". The regular expression "The|quick|brown|fox" (without the quotes) works for the Match Regular Expression vi but not the Match Pattern vi. Below is a picture of the block diagram and the front panel results:
    The Help says that the Match Regular Expression vi performs somewhat slower than the Match Pattern vi, so I started with the latter. But since it doesn't work for me, I'll use the former. But does anyone have any idea of the speed difference? I'd assume it is negligible in such a simple example.
    Thanks!
    Solved!
    Go to Solution.

    Yep-
    You hit a point that's frustrated me a time or two as well (and incidentally, caused some hair-pulling that I can ill afford)
    The hint is in the help file:
    for Match regular expression "The Match Regular Expression function gives you more options for matching
    strings but performs more slowly than the Match Pattern function....Use regular
    expressions in this function to refine searches....
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    A plus sign or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [^0-9]+
    The word Level only if it
    appears at the beginning of the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The first string within parentheses but not containing any
    parentheses within it
    \([^()]*\)
    A left bracket
    A right bracket
    cat, cag, cot, cog, dat, dag, dot, and dag
    [cd][ao][tg]
    cat or dog
    cat|dog
    dog, cat
    dog, cat cat dog,cat
    cat cat dog, and so on
    ((cat )*dog)
    One or more of the letter a
    followed by a space and the same number of the letter a, that is, a a, aa aa, aaa aaa, and so
    on
    (a+) \1
    For Match Pattern "This function is similar to the Search and Replace
    Pattern VI. The Match Pattern function gives you fewer options for matching
    strings but performs more quickly than the Match Regular Expression
    function. For example, the Match Pattern function does not support the
    parenthesis or vertical bar (|) characters.
    Characters to Find
    Regular Expression
    VOLTS
    VOLTS
    All uppercase and lowercase versions of volts, that is, VOLTS, Volts, volts, and so on
    [Vv][Oo][Ll][Tt][Ss]
    A space, a plus sign, or a minus sign
    [+-]
    A sequence of one or more digits
    [0-9]+
    Zero or more spaces
    \s* or * (that is, a space followed by an asterisk)
    One or more spaces, tabs, new lines, or carriage returns
    [\t \r \n \s]+
    One or more characters other than digits
    [~0-9]+
    The word Level only if it begins
    at the offset position in the string
    ^Level
    The word Volts only if it
    appears at the end of the string
    Volts$
    The longest string within parentheses
    The longest string within parentheses but not containing any
    parentheses within it
    ([~()]*)
    A left bracket
    A right bracket
    cat, dog, cot, dot, cog, and so on.
    [cd][ao][tg]
    Frustrating- but still managable.
    Jeff

  • Using the XPATH expression function in Transformation activity

    Hi,
    I have to map the variable value(other than the source variable) to one of the node in the target variable in the transformation activity. For that I am using the XPATH expression function bpws:getVariableData ('variableName') and map it to corrsponding target node. But this mapping is not at all happening. The same prolem occurs while using function ora:getInstanceID() in transformation function. Then I could find a metalink note id: 387381.1,saying it as the bug in 10.1.2.2 BPEL PM, which they are covering in the next release. But our BPEL PM version is 10.1.3.3. But still the same type of problem occurs.
    Please let me know, is there are any solution for using the ora:getInstanceID() , bpws:getVariableData in Transformation activity.

    Hi,
    I dont understand why would you need to use the "bpws:getVariableData" function.
    When you are mapping a source-node to a target-node, it usually assigns the value in the source-node to the target-node, which is as good as using the "bpws:getVariableData" function.
    So, technically speaking you need to use this function explicitly to achieve that ...
    Also, if you want the instance-id, you can use the "ora:getInstanceId()" directly in the BPEL code than using it in the transformation.
    Regards,
    Madhu.

  • XPATH query behaves differently depending on presence of default namespace

    I'm curious to know why an XPATH query seems to behave differently depending on whether the default namespace is present in the query.
    My test case is as follows:
    I use a table called xml_messages (id number, message xmltype) containing two rows - one where xmlns is specified and the other without.
    1. Default namespace is specified:
    <?xml version="1.0"?>
    <Bereken xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Fout="false" Identifier="21-4-2008 12:55:02" xmlns="http://schemas.myco.nl/services/IPP">
    <Reglementen>
    <Reglement Ind="21000005" dlnsts="6">
    <Producten>
    <Product Ind="1002" ogr="27098.00" bbr="27098.00" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1032" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1052" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1062" ogr="0" bbr="2389.968" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3002" ogr="18968.00" bbr="5690.4" igl="0" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3032" ogr="0" bbr="0" igl="0" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3502" ogr="2845.00" bbr="2845.00" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="5002" ogr="3794.00" bbr="3794.00" igl="0" elt="18" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7502" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7503" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="8101" ogr="0" bbr="0" igl="65" elt="65" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7002" ogr="0" bbr="8724.6" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7202" ogr="0" bbr="0" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7302" ogr="0" bbr="0" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    </Producten>
    </Reglement>
    </Reglementen>
    <Parameters gbtd="1957-12-18T00:00:00.0000000+01:00" gsl="Vrouw" pdr="2008-03-01T00:00:00.0000000+01:00" hdgs="40000" ptp="100" />
    </Bereken>
    2. No default namespace specified:
    <?xml version="1.0"?>
    <Bereken xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Fout="false" Identifier="21-4-2008 12:55:02" >
    <Reglementen>
    <Reglement Ind="21000005" dlnsts="6">
    <Producten>
    <Product Ind="1002" ogr="27098.00" bbr="27098.00" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1032" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1052" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="1062" ogr="0" bbr="2389.968" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3002" ogr="18968.00" bbr="5690.4" igl="0" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3032" ogr="0" bbr="0" igl="0" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="3502" ogr="2845.00" bbr="2845.00" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="5002" ogr="3794.00" bbr="3794.00" igl="0" elt="18" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7502" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7503" ogr="0" bbr="0" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="8101" ogr="0" bbr="0" igl="65" elt="65" pgs="63758.00" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7002" ogr="0" bbr="8724.6" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7202" ogr="0" bbr="0" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    <Product Ind="7302" ogr="0" bbr="0" igl="65" elt="130" pgs="0" slt="65" plt="0" reg="0" orf="0" />
    </Producten>
    </Reglement>
    </Reglementen>
    <Parameters gbtd="1957-12-18T00:00:00.0000000+01:00" gsl="Vrouw" pdr="2008-03-01T00:00:00.0000000+01:00" hdgs="40000" ptp="100" />
    </Bereken>
    Next, I use the following two queries to get attribute values from the xml messages:
    First query using xmlns:
    select extractvalue(value(v),'/Product/@Ind' ) ind
    , extractvalue(value(v),'/*/@Ind' ) ind2
    from xml_messages f
    , TABLE(XMLSequence( extract(f.message
         ,'/Bereken/Reglementen/Reglement/Producten/Product'
                                  ,'xmlns="http://schemas.myco.nl/services/IPP"'
                                  ))) v
    where f.id = 1; -- Selects from the xmltype message that does have xmlns specified
    This returns (as the first row)
    IND IND2
    ____ 1002
    ^
    |------ Nothing is returned by the XPATH /Product/@Ind
    Second without using xmlns
    select extractvalue(value(v),'/Product/@Ind' ) ind
    , extractvalue(value(v),'/*/@Ind' ) ind2
    from xml_messages f
    , TABLE(XMLSequence( extract(f.message
         ,'/Bereken/Reglementen/Reglement/Producten/Product'
                                  ))) v
    where f.id = 2; -- Selects from the xmltype message that has no xmlns
    This returns (as the first row)
    IND IND2
    1002 1002
    According to XMLSpy, the correct XPATH to get the "Ind" attribute is "/Product/@Ind" so what I dont understand is why query one doesnt return any data when using a default namespace.
    The XPATH "/*/@Ind" works in both cases and can be used as a workaround, but it seems less elegant than using the proper XPATH.
    I've tried this test case in 9i and 10g, in sqlplus and TOAD, with the same results in all cases.
    Can anyone provide some insight as to why this behavior occurs?

    Thanks, A_Non,
    adding the third parm to the extractvalue part of the query works.
    ie:
    select extractvalue(value(v),'/Product/@Ind', 'xmlns="http://schemas.myco.nl/services/IPP"' ) ind
    , extractvalue(value(v),'/*/@Ind' ) ind2
    from xml_messages f
    , TABLE(XMLSequence( extract(f.message
         ,'/Bereken/Reglementen/Reglement/Producten/Product'
                                  ,'xmlns="http://schemas.myco.nl/services/IPP"'
                                  ))) v
    where f.id = 1;               
    I had not expected this because I thought the xml fragment returned by the extract didnt include the default namespace.
    However, when looking at the query in more detail, its clear Oracle automatically includes the xmlns part in the returned xml fragment.
    One of the rows in the xml fragment:
    <Product xmlns="http://schemas.myco.nl/services/IPP" Ind="1002" ogr="27098.00" bbr="27098.00" igl="65" elt="130" pgs="63758.00" slt="65" plt="0" reg="0" orf="0"/>

  • Xpath Expression/Functions in XSLT Mapper

    Manual says I can use the orcl functions as well as Xpath Expressions, but when I try to execute it does not work? am I missing something her?
    Trying to get a variable data into the target schema , the var is not in the source data schema?
    Any suggestions?

    Can you explain a bit more what you want to do. It's very vague right now. Probably will be able to help you out.
    Thanks

  • Insert Stmt behaving differently within a PL/SQL block than independently

    I have an INSERT INTO statement that is behaving different within a PL/SQL block than it does if ran as an independent SQL query. When executed within a PL/SQL block the INSERT statement does insert rows, but only less than 50% of the rows returned by the SELECT statement used by the INSERT. There are no constraints and the only check on the destination table is a NOT NULL for supplier_id column.
    BEGIN
        INSERT INTO suppliers (supplier_id, supplier_name)
        SELECT account_no, name FROM customers WHERE city = 'Newark';
    END;Can anyone help me with this?
    Thanks

    Thought this sounded familiar:
    INSERT INTO statement that is behaving different within a PL/SQL block

Maybe you are looking for

  • Quickly add music without iTunes Match

    Ok. I have iTunes Match working perfectly and I love it, except for one thing. I import a large music file... it's a 1-hour megamix (about 60mb) and I want to immediately get it on my iPhone and head out the door for a workout. But I have to wait til

  • Any URL's that demo drill-down reports?

    Hi, Just took a new features in Oracle 10g class. The instructor mentioned that webpages could be created with JDeveloper that had a drill-down capability. Anyone know of any live examples on the web? Thanks,

  • Initial TouchPad Setup: Device will not power on!

    This morning I received my new 32gb WiFi HP TouchPad in the mail. I opened up the contents and than began to charge the device; following the start-up guide. When I plugged in my microUSB charger the center button began flashing (alternating left and

  • Could u pls  send these?

    I need a moderate example for interactive report with little bit complexity in logic could any body provide me any report or atleast link so that I can able to learn ,As Im very fresher to reports Im interested to knew about the reports development b

  • Communication between Netweaver and R/3 System

    Hi, I'm trying out the Netweaver sneak preview for testing the capabilities of the pdk for .net. I've added the development R/3 system (4.6C) of our company to the system landscape of the portal. Does the communication between those two systems requi