using XPath with SQL to extract XML data

Given the data like this:
<?xml version="1.0"?>
<ExtendedData>
   <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>

  <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>

  <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>

  <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>

</ExtendedData>
I usually use extractValue as shown below, for example function to extract the value for the last parameter in the above data, for example:
select extractValue(extended_data,'/ExtendedData/Parameter[@name="RealProv"]/BooleanValue') "my_column_alias" from table
Any ideas on how can I return the value of the parameter xsi: Nil for that node:
<Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
I would like to extract the
true
in
xsi:nil="true"
...

Thank you

Published by: HouseofHunger on May 15, 2012 14:13

Published by: HouseofHunger on May 15, 2012 14:13

ExtractValue() has a third parameter, that we can use to declare the namespace mappings:

SQL> with sample_data as (
  2    select xmltype('
  3  
  4    true
  5    
  6    true
  7    false
  8  ') doc
  9    from dual
 10  )
 11  select extractvalue(
 12           doc
 13         , '/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
 14         , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
 15         )
 16  from sample_data
 17  ;

EXTRACTVALUE(DOC,'/EXTENDEDDAT
--------------------------------------------------------------------------------
true
 

If you are on 11.2.0.2 and upward, extractvalue() is obsolete.
Must use XMLCast/XMLQuery instead:

SQL> with sample_data as (
  2    select xmltype('
  3  
  4    true
  5    
  6    true
  7    false
  8  ') doc
  9    from dual
 10  )
 11  select xmlcast(
 12           xmlquery('/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
 13            passing doc
 14            returning content
 15           ) as varchar2(5)
 16         )
 17  from sample_data
 18  ;

XMLCAST(XMLQUERY('/EXTENDEDDAT
------------------------------
true
 

Note: the prefix xsi is predefined when using Oracle's XQuery, so in this case we must explicitly declare.

Published by: odie_63 on May 15, 2012 15:23

Tags: Database

Similar Questions

  • extract xml data in the collection

    Hello

    I want to extract xml data in a collection of collection


    could any body you tell me if we succeed in sql
    ex:

    declare
    type t_code is table of number;
    type r_rec is record (c_name varchar2 (100),)
    c_code vrachar2 (100),
    c_code_number t_code);
    type t_rec is the table of the r_rec;

    l_xml xmltype: = xmltype (')

    < body >
    <>campaign
    < code > < code > CAMP_1
    < description > Campaign_1 < / description >
    < rateplans >
    < rateplanCode > 1 < / rateplanCode >
    < rateplanCode > 2 < / rateplanCode >
    < rateplanCode > 3 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_2
    < description > Campaign_2 < / description >
    < rateplans >
    < > 11 rateplanCode < / rateplanCode >
    < > 22 rateplanCode < / rateplanCode >
    < rateplanCode > 33 < / rateplanCode >
    < / rateplans >
    < / campaign >
    <>campaign
    < code > < code > CAMP_3
    < description > Campaign_3 < / description >
    < rateplans >
    < > 111 rateplanCode < / rateplanCode >
    < > 222 rateplanCode < / rateplanCode >
    < > 333 rateplanCode < / rateplanCode >
    < / rateplans >
    < / campaign >
    < result >
    < > 00 resultCode < / resultCode >
    < resultText > success < / resultText >
    < / result >
    (< / body > ');

    Start

    Select / * logic exrat value of xml in the final collection * /.
    Double;

    end;

    I want data in the model in my final collection t_rec

    CAMP_1, Campaign_1, nested_table (1,2,3)
    CAMP_2, Campaign_2, nested_table (11,22,33)
    CAMP_3, Campaign_3, nested_table (111,222,333)

    Published by: 948596 on May 17, 2013 05:17

    Like this

    SQL> declare
      2       type t_code is table of number ;
      3       type r_rec is record
      4       (
      5          c_name varchar2(100),
      6          c_code varchar2(100),
      7          c_code_number t_code
      8       );
      9       type t_rec is table of r_rec ;
     10       l_rec t_rec := t_rec();
     11       l_xml xmltype := xmltype
     12                        ('
     13                           
     14                           
     15                           CAMP_1
     16                           Campaign_1
     17                           
     18                           1
     19                           2
     20                           3
     21                           
     22                           
     23                           
     24                           CAMP_2
     25                           Campaign_2
     26                           
     27                           11
     28                           22
     29                           33
     30                           
     31                           
     32                           
     33                           CAMP_3
     34                           Campaign_3
     35                           
     36                           111
     37                           222
     38                           333
     39                           
     40                           
     41                           
     42                           00
     43                           Success
     44                           
     45                           '
     46                        ) ;
     47  begin
     48       for i in (
     49                 select rownum id
     50                      , t1.code
     51                      , t1.description
     52                      , t2.rate_plan_code
     53                      , row_number() over(partition by t1.code order by t2.rate_plan_code) rno
     54                   from xmltable
     55                        (
     56                             '/body/campaign' passing l_xml
     57                             columns
     58                               code        varchar2(100) path 'code',
     59                               description varchar2(100) path 'description',
     60                               rate_plans  xmltype       path 'rateplans'
     61                        ) t1
     62                      , xmltable
     63                        (
     64                             '/rateplans/rateplanCode' passing t1.rate_plans
     65                             columns
     66                               rate_plan_code varchar2(100) path '.'
     67                        ) t2
     68                )
     69       loop
     70            if i.rno = 1 then
     71               l_rec.extend;
     72               l_rec(l_rec.count).c_name := i.description;
     73               l_rec(l_rec.count).c_code := i.code;
     74               l_rec(l_rec.count).c_code_number := t_code();
     75            end if;
     76            l_rec(l_rec.count).c_code_number.extend;
     77            l_rec(l_rec.count).c_code_number(i.rno) := i.rate_plan_code;
     78       end loop;
     79       for i in 1..l_rec.count
     80       loop
     81          dbms_output.put_line(l_rec(i).c_code || '  ' || l_rec(i).c_name);
     82          for j in 1..l_rec(i).c_code_number.count
     83          loop
     84             dbms_output.put_line(l_rec(i).c_code_number(j));
     85          end loop;
     86       end loop;
     87  end;
     88  /
    CAMP_1  Campaign_1
    1
    2
    3
    CAMP_2  Campaign_2
    11
    22
    33
    CAMP_3  Campaign_3
    111
    222
    333
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Using EXTRACT XML data extraction

    Hi, I have a XML file where I want to analyze the fields in a table in DB:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < FIXML > < batch > < MktDataFull BizDt = '2012-07-13' > < Instrmt Sym = "JCPRXU" ID = "JCPRXU" Desc = "JCP.SR. XR. «USD"SecTyp ="CD"Src ="H"subtype = MMY" S "="201209"MatDt = ' 2012-09-20" Mult = Exch "0.01" = "CMD" UOM = "CTL" UOMCcy = "USD" UOMQty = "1" PxUOM = "IPNT" ValMeth = "CD" CpnRt = "1.0" IntAcrl = ' 2012-06-20 ' CpnPmt = ' 2012-09-20 ' NotnlPctOut = "100.0" Snrty = 'SR' RstrctTyp = 'XR' DayCntMeth = "ACT/360" tenor = "0 M" > < DITTA HELP = "US708130AC31" AltIDSrc = "105" / > < HELP AltID = "JCP.SR." "" ""» XR. USD.12U.100"AltIDSrc ="101"/ > < HELP DITTA = '1 201209 JCPRXU' AltIDSrc = 'H' / > < DITTA HELP ="1 201209 JCPRXU"AltIDSrc ="100"/ > < Evnt EventTyp ="5"Dt ="2008-09-19"/ > < Evnt EventTyp = '7' Dt = '2012-09-19' / > < Evnt EventTyp ="19"Dt ="2012-10-05"/ > < Evnt EventTyp ="100"Dt ="2012-07-16"/ > < Evnt EventTyp = '8' Dt ="2012-07-14"/ > < Evnt EventTyp = '9' Dt = '2012-09-20' / > < Evnt EventTyp ="101"Dt = '2012-03-20' / > < Evnt EventTyp ="102"Dt ="2008-09-20"/ > < Evnt EventTyp = « 103 » Dt = « 2008-09-22 » / >< Evnt EventTyp = « 104 » Dt = « 2012-09-19 » / >< Evnt EventTyp = « 111 » Dt = « 2012-09-20 » / >< Evnt EventTyp = « 112 » Dt = « 2012-06-20 » / >< Evnt EventTyp = « 113 » Dt = « 2012-03-20 » / >< Evnt EventTyp = « 114 » Dt = « 2012-07-12 » / >< Evnt EventTyp = « 115 » Dt = « 2012-07-16 » / >< / Instrmt >< complet Typ = « 6 » Px = Mkt « 99.7433368 » = « CMD » QCond = « 6 » PxTyp = « 1 » OpenClsSettlFlag = « 1 » >< / Full >< complet Typ = « 6 » Px = « 234.5254 » Mkt = QCond « CMD » = « 6 » PxTyp = « 6 » ' OpenClsSettlFlag = '1' > < / Full > < full Typ = "Y" Px = Mkt "40.0" = 'CMD' PxTyp = '1' OpenClsSettlFlag = '1' > < / Full > < full Typ = '6' Px = "234.5212" Mkt = QCond 'CMD' = '7' PxTyp = '6' OpenClsSettlFlag = '1' > < / Full > < full Typ = Mkt "B" = 'CMD' OpenClsSettlFlag = '4' Sz = '0' > < / Full > < full type = 'C' Mkt = 'CMD' OpenClsSettlFlag = '4' Sz = '0' > < / Full > < full Typ = 'z' Px = Mkt '0.18' = 'CMD' PxTyp = '1' OpenClsSettlFlag = '1 '. > < / full > < full Typ = 'y' Px = "0.1899965" Mkt = QCond 'CMD' = '6' PxTyp = '5' OpenClsSettlFlag = '1' > < / Full > < InstrmtExt > < Attrb Typ = '100' Val = '24' / > < Attrb Typ = '101' Val = '0' / > < Attrb Typ = '109' Val = '0' / > < Attrb Typ = '103' Val = '24' / > < Attrb Typ = '102' Val = '24' / > < Attrb Typ = '110' Val = '3' / > < Attrb Typ = '29' Val = 'Y' / > < Attrb Typ = '112' Val = 'Y ' /. > < / InstrmtExt > < / MktDataFull > < / batch > < / FIXML >


    Right now, I'm just trying to extract the first 3 fields, BizDt, Bal and id I use to analyze the following:


    SELECT
    Extract (value (p), '/BizDt') .getStringVal () AS DATE_,.
    Extract (value (p), ' /Instrmt/Sym').getStringVal (AS SYMBOL),)
    Extract (value (p), ' /Instrmt/ID').getStringVal () AS ID_)

    OF s TABLE_NAME.
    TABLE (XMLSEQUENCE (Extract (xmlType.createXml (s.CDS_CLOB), ' FIXML/batch/MktDataFull / *'))) p
    WHERE s.ID_ = 1

    But I get nothing back. My guess is the because the XML data does not have opening tags and formal closing, because if I change my XML like this:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < FIXML > < batch > < MktDataFull > < BizDt > 2012 - 07 - 13 < / BizDt > < Instrmt > < Sym > JCPRXU < / Sym > < ID > JCPRXU < /ID > < Desc > JCP.SR. XR. USD < / Desc > < SecTyp > CD < / SecTyp > < / Instrmt > < / MktDataFull > < / batch > < / FIXML >

    I was able to get the data. Therefore, in order so solve this problem, what should I do with my original XML? Can I format the tags?

    Thank you

    When you nest xsl: for each of the elements, the select expression is evaluated in the context of the enclosing instance.

    Consider this:

    
      
    

    This means you are trying to match items complete as children Instrmt, that is not correct, because they are actually siblings.
    In the same goes for HELP, Evnt etc.

    I don't know what kind of structure you want.
    Caps all does not much sense given that groups of brothers of repeat items that have no apparent correlation between them. Essentially, you end up with a big Cartesian product.

    I would approach this by storing repeated elements in different tables with a parent/child relationship to preserve the hierarchical nature of the data (if necessary).

  • Extract XML data using XML table NULL recovery

    Hello

    I use XMLtable to recover data using XMLtable

    XML

    "< env:Envelope xmlns:env = ' http://schemas.xmlsoap.org/SOAP/envelope/ ">

    < env:Header > < / env:Header >

    < env:Body >

    " < = Xmlns:ns1 CreditBureauResponse ' http://www.example.org "xmlns =" " http://www.example.org ">

    < ns1:Body >

    < ns1:MGResponse > & lt; MGResponse xmlns = "urn: crif - messagegateway:2006 - 08-23" > & lt; U2:AUE_RES xmlns:u2 = "urn: AUE" > & lt; U2:response > & lt; U2:CBApplicationId > 123456789 & lt; / u2:CBApplicationId > & lt; U2:ProviderApplicationNo > 123 & lt; / u2:ProviderApplicationNo > & lt; U2:PreviousPhase > D & lt; / u2:PreviousPhase > & lt; U2:ActualPhase > D & lt; / u2: ActualPhase > & lt; U2:ApplicationDeleted > 0 & lt; / u2:ApplicationDeleted > & lt; / u2:Response > & lt; / u2:AUE_RES > & lt; / MGResponse > < / ns1:MGResponse >

    < / ns1:Body >

    < / CreditBureauResponse >

    < / env:Body >

    "< / env:Envelope >.

    I would like to know where I am going wrong

    SELECT x1.*

    OF tmp_xml_aue t.

    XMLTABLE (XMLNAMESPACES ('http://schemas.xmlsoap.org/soap/envelope/"as"env","http://www.example.org"as 'ns1", default'http://www.example.org'), )

    ' / env:Envelope / env:Body / CreditBureauResponse' T.OBJECT_VALUE by the WAY

    columns MGRESPONSE xmltype PATH "ns1:Body/ns1:MGResponse/text()") X 1,

    XMLTABLE (XMLNAMESPACES ("urn: crif - messagegateway:2006 - 08-23' as"v1", default" urn: AUE' '), ' / MGResponse/AUE_RES ' PASSAGE xmltype (DBMS_XMLGEN.convert (X 1.) MGRESPONSE. GETCLOBVAL(), 1))

    columns CBAPPLICATIONID varchar2 (15) WAY "response/CBApplicationId.

    ) X 2;

    Hello

    I saw your question and I hope that the link below will help you solve your solution:

    https://Oracle-base.com/articles/Misc/XMLTable-query-XML-data-from-SQL

    If there are problems more made me know I'll like you the exact solution for your query.

    Kind regards

    Vinoth.

  • SQL to read XML data

    Hello

    I have a XML string such as stored on my DB

    < ? XML version ="1.0" encoding=' UTF - 8'? »» >

    < map >

    < Entry >

    < string > ContractId < / string >

    < string > 46781552 < / string >

    < / Entry >

    < Entry >

    < string > ContactEmail < / string >

    < string > [email protected] < / string >

    < / Entry >

    < Entry >

    < string > ContactName < / string >

    < string > JohnYIopo Doe < / string >

    < / Entry >

    </ map >


    do you know if there is a way to extract the value

    ContractId: 46781552

    ContactEmail: [email protected]

    Contact: JohnYIopo Doe

    using XMLQuery or SQL


    Thanks in advance!

    For a faster and better response, you should always post a question in the dedicated forum section.

    In your case, it should be General XML .

    Something like that?

    with t as)

    Select xmltype(q'!)

    ContractId

    46781552

    ContactEmail

    [email protected]

    ContactName

    JohnYIopo Doe

    !') Double TX

    )

    -------

    SELECT

    x.contract_id,

    x.contact_email,

    x.contact_name

    t,.

    XMLTABLE)

    "/ map".

    from tx

    COLUMNS

    path VARCHAR2 (100) of contract_id ' input [1] / [2] string',

    path VARCHAR2 (100) of contact_email ' input [2] / [2] string',

    "path VARCHAR2 (100) of contact_name ' input [3] String [2].

    ) x

    ;

    CONTRACT_ID CONTACT_EMAIL CONTACT_NAME

    -------------------- ------------------------------ ------------------------------

    46781552 [email protected] JohnYIopo Doe

    And don't forget, the are case sensitive.

    Now, you must understand why there are kind of table - references (like [n]) are actually there.

    Try to remove the (marked in red), you will find an error message like "" ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element

    Explicit, right?

    Reasoning: If you start to navigate in the structure of the XML from the root that is to and watch carefully, you will find that this pattern is repeated for the 6 values (in your example)

    some_value_here *.

    If I break your example more far, it will be something like this:

    ContractId

    46781552

    ContactEmail

    [email protected]

    ContactName

    JohnYIopo Doe

    Thus, the XML parser is not able to distinguish those who are you referring to exactly and ORA-19279 triggers out of confusion.

    So what did our request was.

    ContractId

    46781552

    ContactEmail

    [email protected]

    ContactName

    JohnYIopo Doe

    I hope this helps.

  • Help me with SQL Query to retrieve data from a view

    Hello Guru,

    I need help in my sql query.
    I use SQL TeraData.
    I want an Oracle result in the following form-

    Open tickets
    Open months failure / Repair Service s/o improvement request Total general
    2009-01-2 4 4 5 15
    2009-02 1 0 2 3 6
    2009-03 4 1 2 2 9
    Grand Total 7 5 8 10 30


    I wrote the query as where - TIME_PERIOD, RQST_TYPE_DM and DEMAND_SUMMARY_FCT are the points of view and I extract the data from the views only.

    Select NVL (CA. TIME_PERIOD. PERIOD_CD, 'Total') THAT year.
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% of Break' THEN 1 END) as BreakFix
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'N/a', 1 END) by n/a
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'Improvement' THEN 1 END) accessories
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% Service' THEN 1 END) as ServiceRequests
    COUNT (CA. RQST_TYPE_DM. RQSTTYP_DESC) AS grand_total
    FROM CA. TIME_PERIOD, CA. RQST_TYPE_DM, CA. DEMAND_SUMMARY_FCT
    WHERE (CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = CA. RQST_TYPE_DM. RQSTTYP_ID)
    AND (CASE
    WHEN CA. DEMAND_SUMMARY_FCT. MONTH_ID = CA. TIME_PERIOD. PERIOD_ID, 1
    WHEN {fn concat ({fn concat (SUBSTR (CA. TIME_PERIOD. {(PERIOD_CD, 3, 4),'-')}, SUBSTR (CA. TIME_PERIOD. PERIOD_CD, 7, 2))} BETWEEN ' 2009-01' AND ' 2009-03' THEN 1
    WHEN CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = '1' then 1
    END) = 1
    GROUP BY ROLLUP (CA. TIME_PERIOD. PERIOD_CD)

    After executing the query, I get the following error:
    3076: syntax Error: Data Type 'Time' does not match a defined Type name.
    :( Kindly help me with this and let me know where I'm wrong... Please.

    Messages indicates something wrong with your data... It would seem that the data does not match your format mask.

    Thus, the data or the format mask.

  • Extracting XML data limit?

    Hi all

    Can someone help with the data limit for retrieving XML from a text field?

    Scenario: I have a text field with the limit set for the 1000 characters. Can you please let me know if there is any limitation extracting XML with a text field with 1000 characters?


    Thank you
    Yassine

    Hi John,

    I have not met a deadline, I had 8000-character text fields (as much as can fit on an A4 page) and I had pictures of 4 MB in a data node.

    Concerning

    Bruce

  • Extract XML data to a text box

    How could I get the XML data a box?

    Course code: (it will not display anything!)

    var dyoXML:XML = new XML();
    dyoXML.ignoreWhite = true;

    dyoXML.onLoad = {function (success)}
    {if (Success)}
    disemail. Text = This;
    }
    }

    dyoXML.load ("http://www.myweb.com/mails.php");

    you not set $fin in your php file.  use:

    $fin = $_POST ['end'];

    to define it.  and you should be specifying the POST method to send data to your php file.  (unless you send end via the query string that you aren't.)

  • How to use a variable to browse the XML data

    My chart has xml data that looks like this:

    < getViewResponse >

    < getViewResult >

    < DocumentElement >

    < ColumnChart >

    < month >

    "Dec".

    < NetIncome >

    1000

    < ColumnChart >

    etc.

    etc.

    the following lines in actionscript work perfectly for the table:

    resultxml = event.result.getViewResult.DocumentElement.ColumnChart as XMLList

    chart data provider

    _chartDP = new XMLListCollection (resultxml);

    The last argument of Colum graphic in DocumentElement.ColumnChart will change. I want to make this variable instead.

    I tried DocumentElement +'. ' + this. [ColumnChart] but I get an error telling me that the property does not exist.

    The following almost works:

    event.result.getViewWithTitlesResult.DocumentElement. *.

    but my card has a series of additional data empty.

    How can I adjust the latter to a variable?

    If the data that currently say you XMLList has a single point, just cast to XML with XML (myXMLLIST) or "myXMLLIST in Xml format.

    If this post answers your question or assistance, please mark it as such.

  • Problems with the display of XML data

    I'm a bit new to Flash and have problems out XML data in Flash. Basically, when I saw publication, all data load XML file and displays very well. But when I actually publish the file and view in a browser, no data is displayed.

    Data from XML is happening in the areas of dynamic text (title, description, image).

    I use an absolute URL to retrieve the XML data, and I tried a lot of text integrated solutions, and nothing has worked. Here, any help would be greatly appreciated.

    I have attached the script action, but also a piece of the XML file I get the data.

    After going through each difficulty as possible, I could find, I managed to miss the information contained in the link below. This fixed my issue.

    http://www.Adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213

  • How to pick up the edits made by someone else using Subversion with SQL dev

    Hi, I have just installed SQL Developer 1.5.1 version and connected to an existing subversion repository. Successfully, I checked a .sql file and made a few changes and check back. My problem is picking up changes made by others. When someone else adds and commits a new file I can see it in the browser of version management, but I have not found how can I update my working space with it. The update option in the versioning menu is grayed out unless I have a file is opened and then it applies to a single file. I tried opeing the file I wanted to from the browser versioning, but update is always grayed out.

    I could check the folder again and I got the news, but this did not seem like the best way to do it. Also, I have not found a way to disconnect a storage folder once it has been verified, so I have two copies.

    Thanks for your help...

    Hi, again, I did some research and wanted to update this post. First of all, after reading the info on what the integration of subverion with SQL developer is supposed to do, I have concluded it does exactly what it says it isn't, but not what I expected based on my use of the subclipse for eclipse plugin. With subclipse, there is a synchronization option that you can do at the folder level and see all the files that need to be updated or committed. In SQL developer, it appears that the validation and update are available at the file level and so if something is not in the folder (added by another user or deleted), the validation and the update are not options. Also, you can only view folders, not files. I think this implementation leaves much to be desired but, for me, maybe better than nothing.

    In my research I found a post for a different problem, but I decided to try this anyway: problem connecting SQL Developer 1.5.1 with Subversion 1.5 (win XP)
    Posted the: August 7, 2008 05:29

    user594768 wrote:
    The problem is with svnkit. Until now sqldeveloper use version 1.1.6.
    You can remedy with svnkit 1.2. You must download it from http://www.svnkit.com/org.tmatesoft.svn_1.2.0.standalone.zip and put some files in the directory of extension sqldeveloper.

    copy
    -jna.jar
    -svnkit - javahl.jar (rename it to svnjavahl.jar)
    -svnkit.jar
    -svnkitsrc.zip
    -trilead.jar

    of svnkit 1.2 to

    % sqldeveloper%\jdev\extensions\oracle. JDeveloper.subversion

    OK, I tried this on a single machine, and it does not seem to do something but did not cause a problem either. But then, I decided to experiment and updated my system with TortoiseSVN 1.5. My idea was that if I could use tortoise to do updates that I couldn't not do in SQL developer, if the SQL Developer acknowledged that the case fell within subversion. I checked the files I wanted out of the repository using the turtle, then Developer SQL that acknowledges that it has been verified and SQLdev has been able to make changes and commit the change. Everything was going as he worked.

    I went to my other machine which had not been updated as described above and installed the turtle and went through the same steps to check the files I wanted. Developer SQL has not recognized that they were versioned. I've updated as described above, so now the SQL Developer knows he is transferred and I can commit the changes to come.

    Don't know why it works, and it is a funky workaround, maybe someone else has a better solution.

  • Extract XML Data using XMLTable 1-n relationship data

    Dear all,

    The following query works well.
    with t as (select XMLType('<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
       <env:Header/>
       <env:Body>
          <nm:CustomerCRMByIDResponse xmlns:nm="http://sap.com/xi/CRM/Global2" xmlns:prx="urn:sap.com:proxy:DCT:/1SAI/TAS57DF0B317943DEAE3C49:702">
             <MessageHeader/>
             <BusinessPartner>
                <InternalID>2200117598</InternalID>            
                <AddressInformation>
                   <UUID>51471396-9ae8-3cc0-e100-80000a031a28</UUID>
                                        <DefaultIndicator>true</DefaultIndicator>
                   <Address>
                      <PostalAddress>
                         <CountryCode>DE</CountryCode>
                         <CountryName>Country Name</CountryName>
                      </PostalAddress>
                      <Telephone>
                         <Number>
                            <SubscriberID>0711/123456</SubscriberID>
                            <ExtensionID>0</ExtensionID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <MobilePhoneNumberIndicator>false</MobilePhoneNumberIndicator>
                         <SMSEnabledIndicator>false</SMSEnabledIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Telephone>
                      <Telephone>
                         <Number>
                            <SubscriberID>0711/999999</SubscriberID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <MobilePhoneNumberIndicator>true</MobilePhoneNumberIndicator>
                         <SMSEnabledIndicator>true</SMSEnabledIndicator>
                         <DefaultIndicator>false</DefaultIndicator>
                      </Telephone>
                      <Facsimile>
                         <Number>
                            <SubscriberID>0711/999888</SubscriberID>
                            <ExtensionID>99</ExtensionID>
                            <CountryCode>DE</CountryCode>
                            <CountryDiallingCode>+49</CountryDiallingCode>
                            <CountryName languageCode="de">Country Name</CountryName>
                         </Number>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Facsimile>
                      <EMail>
                         <URI>[email protected]</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </EMail>
                      <EMail>
                         <URI>[email protected]</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>false</DefaultIndicator>
                      </EMail>
                      <Web>
                         <URI>www.xyz.com</URI>
                         <UsageDeniedIndicator>false</UsageDeniedIndicator>
                         <DefaultIndicator>true</DefaultIndicator>
                      </Web>
                   </Address>
                </AddressInformation>
                <AddressInformation>
                   <UUID>514a519b-39a2-4890-e100-80000a031a28</UUID>
                                        <DefaultIndicator>false</DefaultIndicator>
                   <Address>
                      <PostalAddress>
                         <CountryCode>AT</CountryCode>
                         <CountryName>Österreich</CountryName>
                      </PostalAddress>
                   </Address>
                </AddressInformation>
             </BusinessPartner>
          </nm:CustomerCRMByIDResponse>
       </env:Body>
    </env:Envelope>') xml_data from dual)
    SELECT xmlresponse.*
    FROM t, XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                                                      'http://sap.com/xi/CRM/Global2' AS "nm",
                                                                      'urn:sap.com:proxy:DCT:/1SAI/TAS57DF0B317943DEAE3C49:702' AS "prx"
                                                                      ),
                                            'for $BusinessPartner in /env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner                  
                        return $BusinessPartner'
                                            PASSING xml_data
                                            COLUMNS
                                            Internalid Varchar2(4000) Path 'InternalID'  
                                            ) xmlresponse;
    As you can see, a "BusinessPartner" can have several "AddressInformation.
    and a "AddressInformation" can have several 'phone '.

    Can anyone suggest me how can I retrieve both InternalID & UUID in a query? For example above output should look as follows...
    InternalID UUID 
    2200117598 51471396-9ae8-3cc0-e100-80000a031a28
    2200117598 514a519b-39a2-4890-e100-80000a031a28
    Thank you much in advance.

    Kind regards
    Hari

    Here is a basic example of a method to achieve what you need

    SELECT xmlresponse.Internalid, xml2.uuid
      FROM t,
           XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                  'http://sap.com/xi/CRM/Global2' AS "nm"
                                 ),
                    '/env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner'
                    PASSING xml_data
                    COLUMNS
                    Internalid   Varchar2(20) Path 'InternalID',
                    addrinfoxml  XMLType      PATH 'AddressInformation'
                   ) xmlresponse,
           XMLTable('/AddressInformation'
                    PASSING xmlresponse.addrinfoxml
                    COLUMNS
                    UUID         Varchar2(80) Path 'UUID'
                   ) xml2;
    

    Changes:
    I deleted one of the namespaces that you include those who are included in a XPath statement.
    I've shortened your data types.
    I went for the simple XMLTable joined an XMLTable, instead of a single XMLTable approach using a FLWOR statement.
    You can include the addrinfoxml in your SELECTION list column to see the data passed between the two if you wish.

    Addition:
    Here is an approach for a single XMLTable.

    SELECT xmlresponse.*
      FROM t,
           XMLTable(Xmlnamespaces('http://www.w3.org/2003/05/soap-envelope' AS "env",
                                  'http://sap.com/xi/CRM/Global2' AS "nm"
                                 ),
                    'for $BP in /env:Envelope/env:Body/nm:CustomerCRMByIDResponse/BusinessPartner
                      for $ai in $BP /AddressInformation
                       return {$BP/InternalID}{$ai/UUID}'
                    PASSING xml_data
                    COLUMNS
                    Internalid   Varchar2(20) Path 'InternalID',
                    UUID         Varchar2(80) Path 'UUID'
                   ) xmlresponse;
    

    Published by: A_Non on March 25, 2013 09:41
    Added in the XQuery solution

  • Extract XML data online on a regular basis.

    Hi guys, I am new to the PL/SQL and im kind of stuck here, what I'm trying to Edifier is:

    There is this file online: [indicadores.xml | http://www.dof.gob.mx/indicadores.xml], which contains data from Exchange rate I need to use.

    I just need to get the < item > elements.

    This feed is updated every day, so what I intend to do is to recover this data each day at midnight and store the data in a single table with the following structure:

    CREATE TABLE RATES
    (
    title VARCHAR2 (CHAR) NOT NULL,
    Description NUMBER NOT NULL,
    pubDate DATE NOT NULL,

    );

    I don't know if it is possible, nor how, I was checking some of the messages on this forum, but most of them parse a local XML file and not a online, also I do not know how can I do on a daily basis.

    Any help will be greatly appreciated!

    Thank you!

    José Manuel Hurtado Portugal

    In this case, you can also do

    SQL> select extractvalue(t.x,'//dc:date', 'xmlns:dc="http://purl.org/dc/elements/1.1/"') datepub,
           extractvalue(t.x,'//cb:value', 'xmlns:cb="http://staging.bis.org/rss-cb/1.0/') valuepub,
           extractvalue(t.x,'//cb:rateName', 'xmlns:cb="http://staging.bis.org/rss-cb/1.0/') ratename
      from (select httpuritype ('http://www.banxico.org.mx/rsscb/rss?BMXC_canal=cetes').getxml () x from dual) t
    /
    DATEPUB                        VALUEPUB                       RATENAME
    ------------------------------ ------------------------------ ------------------------------
    2010-11-30T11:37:29-06:00      4.35                           CETES28
    1 row selected.
    
  • SQL to create xml data

    Hi all - I have an obligation to create an XML from a table. The table has produced number repeated for each attrbiutes values. Is it possible to create an xml file with product_id that only once and all attributes and values listed under that. Help, please

    Example of

    WITH tmp AS
    (SELECT '0983433' PRODUCT, 'color' prd_attr, 'blue' AS val
    OF THE DOUBLE
    UNION
    SELECT "0983433" AS a product, prd_attr 'size', '23' LIKE val
    OF THE DOUBLE
    UNION
    SELECT "0983433" AS a product, prd_attr 'group', 'beauty' AS val
    OF THE DOUBLE
    Union
    SELECT "0384491" AS a product, prd_attr of 'sale', 'Y' HAVE val
    OF THE DOUBLE
    UNION
    SELECT "0384491" AS a product, prd_attr 'size', '23' LIKE val
    OF THE DOUBLE
    UNION
    SELECT "0384491" AS a product, prd_attr 'segment', 'lie' AS val
    THE DOUBLE)
    SELECT *.
    OF the tmp

    And the file must be as follows:

    PRODUCTS >
    -< PRODUCT >
    < ID > 0384491 < /ID >
    -NATURE >
    Y < SALE > < / SALE >
    Mens < SEGMENT > < / SEGMENT >
    < SIZE > 23 < / SIZE >
    < / NATURE >
    < / PRODUCT >
    -< PRODUCT >
    < ID > 0983433 < /ID >
    -NATURE >
    < COLOR > blue < / COLOR >
    beauty of < GROUP > < / GROUP >
    < SIZE > 23 < / SIZE >
    < / NATURE >
    < / PRODUCT >
    < / PRODUCT >

    Help, please

    Functions SQL/XML is the best option.

    SQL> WITH tmp AS (
      2    SELECT '0983433' AS product, 'color' prd_attr, 'blue' AS val FROM DUAL UNION ALL
      3    SELECT '0983433' AS product, 'size' prd_attr, '23' AS val FROM DUAL UNION  ALL
      4    SELECT '0983433' AS product, 'group' prd_attr, 'beauty' AS val FROM DUAL UNION ALL
      5    SELECT '0384491' AS product, 'sale' prd_attr, 'Y' AS val FROM DUAL UNION ALL
      6    SELECT '0384491' AS product, 'size' prd_attr, '23' AS val FROM DUAL UNION ALL
      7    SELECT '0384491' AS product, 'segment' prd_attr, 'mens' AS val FROM DUAL
      8  )
      9  SELECT xmlserialize(document -- for display purpose only
     10           xmlelement("PRODUCTS",
     11             xmlagg(
     12               xmlelement("PRODUCT",
     13                 xmlelement("ID", product)
     14               , xmlelement("NATURE",
     15                   xmlagg(
     16                     xmlelement(evalname(upper(prd_attr)), val)
     17                   )
     18                 )
     19               )
     20             )
     21           )
     22           indent
     23         ) as result
     24  FROM tmp
     25  GROUP BY product
     26  ;
    
    RESULT
    --------------------------------------------------------------------------------
    
      
        0384491
        
          Y
          mens
          23
        
      
      
        0983433
        
          blue
          beauty
          23
        
      
    
     
    

    If the order of the elements is a meaning, you can add the good ORDER BY clause, for example

    xmlagg(
      xmlelement(evalname(upper(prd_attr)), val)
      order by prd_attr
    )
    

    Published by: odie_63 on 14 nov. 2012 18:40

  • Problem with SQL report to modify data

    Hi all

    I don't know that I'm writing this question in the right page or not. But my question is: I have a column in my table which is of type varchar. Data in this column are as Fallows:

    257414/45y
    194662223445 8877/j7tg
    .....
    I wanted to know, is anyway I can show this data in my report without any / or - fallow:

    25741445y
    1946622234458877j7tg

    Just for your information, this is a sql report.

    Thank you

    I read your question because how do you remove both the ' / ' and '-' characters. If true do as follows:

    Select REPLACE(REPLACE('194662223445-8877/j7tg','/'),'-','') from DUAL
    

    At the end of the statement where ") of the DOUBLE appears, these two single quote characters have no space between them. That means replace NULL for the characters you want to replace.

    You can test the statement leaving from DOUBLE. Once satisfied, change it to 'from MyTable '.

    I don't know what to tell you on the TTITLE. It of what I used and always works to print a title.

Maybe you are looking for

  • How to upgrade OSX - 10.7.5

    I'm under mountain lion, 10.7.5, seeking to update?

  • C6100 not printing on network

    All computers on the network can no longer print to my C6100. I have reset the connections and I can see the printer on the network. When I ping the server for the printer page, it shows that it works correctly. Is it possible that a recent windows u

  • Graphics driver installation problems - Qosmio G20 PQG21

    Try to install the latest graphics driver (available on the website of toshiba in the United Kingdom) produces an error message this file NV4_mini.sy is unreadable, even if it's there. Any ideas? I tried several times to download and decompression in

  • Satellite A200 - 1 M 8 XP installation has failed

    Right time of the day) I recently purchased laptop Satellite A200 - 1 M 8. Wiped vista thanks 7.0 version sata driver successfully,but this does not work for me again. XP continues, I say it do not format, he asks new driver and won't even try to rea

  • HP pavilion g series laptop: hp pavilion g series starting or admin password

    I'm locked out of my phone and now as soon as I press the power button it asks me to the administrator or the power the password and after 3 attempts, is for me a blocking system 54175937 code... is their a way to remove this password... any help wou