Extract XML Value returns nothing

Hi, I have a table where I put an XMLTYPE column called XML_RESPONSE and a CLOB called XML_RESPONSE_CLOB with the same XML content each.

One of the values of records in the two columns look like this:

<? xml version = "1.0" encoding = "UTF - 8"? >< s : Envelope xmlns:S = » http://schemas.xmlsoap.org/soap/envelope/ « >< Body >< ns2:StampCFDBytesResponse xmlns:ns2 = » http://impl.Controllers.massive.Fe.STO.com/ "xmlns:ns3 = » http://exception.Fe.STO.com/ "><stampedDocument>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGNmZGk6Q29tcHJvYmFudGUgdmVyc2lvbj0iMy4yIiBmb2xpbz0Cinb2IubXgvVGltYnJlRmlzY2FsRGlnaXRhbCBodHRwOi8vd3d3LnNhdC5nb2IubXgvVGltYnJlRmlzY2FsRGlnaXRhbC9UaW1icmVGaXNjYWxEaWdpdGFsLnhzZCIgeG1sbnM6dGZkPSJodHRwOi8vd3d3LnNhdC5nb2IubXgvVGltYnJlRmlzY2FsRGlnaXRhbCIvPgogICAgPC9jZmRpOkNvbXBsZW1lbnRvPgo8L2NmZGk6Q29tcHJvYmFudGU+</stampedDocument></ns2:StampCFDBytesResponse></S:Body></S:Envelope>

I am trying to extract the base64 code, that is inside the < stampedDocument > element.

If I use this code, the procedure runs, but returns nothing:

Select apex_web_service.parse_xml (XML_RESPONSE, "/ / envelope/body/stampedDocument")

in v_stamped from f_cfdi_timbrados where id_cfdi_timbrado = 1002;

If I use the following the procedure returns an error:

Select apex_web_service.parse_xml (XML_RESPONSE, '//Envelope/Body/stampedDocument/stampedDocument ()')

Select apex_web_service.parse_xml (XML_RESPONSE, '//S:Envelope/S:Body/stampedDocument/stampedDocument ()')

Select apex_web_service.parse_xml (XML_RESPONSE, ' / / s: Envelope / Body / stampedDocument')

in v_stamped from f_cfdi_timbrados where id_cfdi_timbrado = 1002;

06503 00000 - "PL/SQL: function returned no value."

* Cause: A call to the PL/SQL function completed, but no RETURN statement has been

executed.

* Action: Function to rewrite PL/SQL, ensuring that it always returns

a value of the appropriate type.

I also tried with the ExtractValue function and retunrs null or an error.

SELECT id_cfdi_timbrado,

EXTRACTVALUE (e.xml_response, ' / envelope/body/stampedDocument ')

'CFDI_BASE_64 '.

OF e f_cfdi_timbrados

WHERE id_cfdi_timbrado = 1002;

Please notify. It's my first experience of XML parsing and it seems that I am lost.

Francisco

The error message provides the clue that you need.  If you were to search on this error message, you will see he's trying to tell you that you are missing a RETURN statement at the end of your function.  Something like

RETURN v_stamped;

That would resolve the issue causing the error ORA.

Regarding the second question, that you will encounter, your clips are not correctly name space which is part of the XML.  For extractValue, there is a third parm

EXTRACTVALUE

If your query would look like

EXTRACTVALUE (e.xml_response, ' / s: Envelope/Body / ns2:stampedDocument ',' xmlns:S = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2 = "http://impl.controllers.massive.fe.sto.com/"')

I leave you to you of apex_web_service.parse_xml of research

That said, depending on your version of Oracle, extractValue might be obsolete and you will have to go in a different direction.

Here are a few tips to post on the forums

Re: 2. How can I ask a question in the forums?

Tags: Oracle Development

Similar Questions

  • Extract specific values of XML (Oracle 11)

    Hello
    First of all... Please excuse my English... I'm Belgian ;)

    I have a 'Messages' table in Oracle 11, with a "xml_request" of type XMLTYPE field. Say that it contains the following data (sorry for the formatting, couldn't help it).

    <? XML version = "1.0" encoding = "UTF-8"? > <!-example XML file generated by XMLSpy v2008 rel. 2 sp2 (http://www.altova.com)-> < answer xsi: schemaLocation = "http://www.ept.lu/soa/2.0/Envelope Envelope_WSLF.xsd" xmlns = "http://www.ept.lu/soa/2.0/Envelope" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:pivot = "http://www.ept.lu/soa/2.0/Pivot" > < header > < senddt > 2010-12-17 T 09: 30:47.0Z < / senddt > < correlationid > 22222222 < / correlationid > < service > < type > WS - ATH < / type > < action > WS-ATH_ActivationSuccess < /. action > < / service > < source > < name > IOP < / name > < id > YYYYYYY < /ID > < / source > < destination > < name > OAO < / name > < id > XXXXXXX < /ID > < / destination > < authentication > < userid > USERID_OAO < / userid > < password > PASSWORD_OAO < / password > < / authentication > < / header > < body > < pivot : customer > < pivot: services > < pivot: service > < pivot: accessServiceId > 13100000000 < / pivot: accessServiceId > < pivot: serviceAttributes > < pivot: attribute > < pivot: name > BOOKING_MANAGER_ID < / pivot: name > < pivot: value > 12521515 < / pivot: value > < / pivot: attribute > < / pivot: serviceAttributes > < pivot: serviceAttributes > < pivot : attribute > < name: PivotTable > DEER < / pivot: name > < pivot: value > 1286001434 < / pivot: value > < / pivot: attribute > < / pivot: serviceAttributes > < / pivot: service > < / pivot: services > < / pivot: customer > < / body > < fault > < code > MI.006 < / code > < reason > success: ATH < / pattern > < failure / > < / answer >

    I'm trying to extract some values based on labels, for example I need to retrieve the value contained in the group with the name "DEER" in a query, in this case waiting for the query to return 1286001434.
    I quickly tried this, which returns nothing (which is not surprised, I guess that's completely wrong):

    Select EXTRACTVALUE (m.xml_request,'/response/body/client/services/service/serviceAttributes/value[@name="STAG"]','xmlns= "http://www.ept.lu/soa/2.0/Envelope") 'DEER '.
    Message m

    Thank you for your help.
  • Req SQL syntax. to extract the value XML [CLOB]

    Hello

    I'll have the XML column in my table.

    I have XML value in CLOB data type. I had an experience using extract XML from SQL syntax.

    But I am unable to extract this file. I need to meet tagname value XML who gave example below.

    For example, the name of the Table is A
    Column name is A1

    The value of column given below here.

    <? XML version = "1.0" encoding = "ISO-8859-1? > < tags > < tag > < tagname > {docval} < / tagname > < tagvalue > ESPRefNotice < / tagvalue > < / tag > < tag > < tagname > {: inputvalue} < / tagname > < tagvalue > 3216 < / tagvalue > < / tag > < tag > < tagname > {officename} < / tagname > < tagvalue > ssvofficename < / tagvalue > < / tag > < / tags >

    Kindly help me on this to extract the value 'tagname' or 'tagvalue' according to the above xml data.

    Thank you
    SELECT warehouse_name warehouse,
       warehouse2."Water", warehouse2."Rail"
       FROM warehouses,
       XMLTABLE('/Warehouse'
          PASSING warehouses.warehouse_spec
          COLUMNS
             "Water" varchar2(6) PATH '/Warehouse/WaterAccess',
             "Rail" varchar2(6) PATH '/Warehouse/RailAccess')
          warehouse2;
    

    check this exp in the documentation
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions228.htm#CIHGGHFB

    the warehouse_spec is of type xmltype. So in your case it is clob then you need to add like what I did in the query...
    XmlType ()...

    Hope that explains everything...

    Ravi Kumar

  • 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

  • How to filter data according to internal application and in case if returns nothing outside the query must return all the lines

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    Select * AB

    where b in (select b BC where b = "2sample")

    This query will return me 1 row, but there are cases where the value of the parameter b is null

    and that it should return all rows in the table

    as

    Select * AB

    where b in (select b BC where b = "2sample")

    which return specific values, but I want to change in a way when the inner query returns nothing then outer query should return all the lines and works as

    Select * AB;

    Is it possible to put in a single query

    Hello

    You seem to ask for different things.  You want all the lines AB when

    1. The parameter ("2sample' in the example) is NULL, or when
    2. There is no corresponding row in the 2 tables (which could happen even if the parameter is not NULL)

    ?

    Assuming you want the option 2, here's one way:

    WITH got_rnk AS

    (

    SELECT ab.*

    DENSE_RANK () (ORDER IN CASE

    WHEN b (IN)

    SELECT b

    BC.

    WHERE b = "2sample" - parameter

    )

    THEN "A".

    OF ANOTHER 'B '.

    END

    ) AS rnk

    AB

    )

    SELECT a, b

    OF got_rnk

    WHERE rnk = 1

    ;

    This does not assume b is unique in each table.

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

  • 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> 
    
  • Extract the value after the period

    Hello

    I am trying to extract the value from each period.

    I have the table data is stored in this mode 172.168.15.10, which is an IP address,.


    My requirement is I need to first value in a query with must return 172
    If I need the value after the second period, it should return 168


    Please suggest me how to write a SQL for the above requirement and oracle 11i Enterprise edition as the database.


    Thank you
    Sudhir

    with regexp

    select
      regexp_substr('172.168.15.10', '\d+', 1, :pos) s
    from dual
    

    without regexp

    select
      substr(s
            , instr(s, '.', 1, :pos) +1
            , instr(s, '.', 1, :pos + 1) - instr(s, '.', 1, :pos) -1
      ) s
    from (select '.'||'172.168.15.10'||'.'
     s  from dual)
    

    Edited by: chris227 the 01.10.2012 01:23

  • Extract xml nested with attributes using plsql

    Hi, I need to extract xml file and insert 2 oracle tables. The xml file is the use of attributes, and I cannot retrieve the element 'code' nested with its attributes in the context of its parent folder "table." Here is a sample of the xml data that I have to extract the date:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < dataset - cv:dataset - cv dateProduced = "2011-09-19 11:50:45 ' xmlns:dataset - cv ="http://www.myurl.com/dataset-cv/1.0.0">"
    < lov >
    < id of the table = "00000000000001000" Name = "Role of the system" isSystem = "true" status = "Enabled" >
    < id code = "00000000000000306" Name = "Helpdesk" code = "1" status = "Enabled" / >
    < id code = "000000000000000307" Name = "Reviewer" code = "2" status = "Enabled" / >
    < id code = "00000000000000308" Name = 'Administrator' code = '3' status = "Enabled" / >
    < /table >
    < id of the table = "00000000000002000" Name = 'Country' sSystem 'false' status = "Enabled" = >
    < id code = "000000000000002004" Name = "AFGHANISTAN" code = "4" status = "Enabled" / >
    < id code = "000000000000002008" Name = 'ALBANIA' code = '8' status = "Enabled" / >
    < id code = "000000000000002010" Name = "ANTARCTICA" code = "10" status = "Enabled" / >
    < /table >
    < / lov >
    < / dataset - cv:dataset - cv >


    I use a query like this that seems to work to get all the attributes of table or all attributes of code element element, but not the code attributes in the context of his record from the table parent.

    SELECT id
    englishname
    status
    FROM XMLTABLE ('for $i //lov//table return $i"
    FROM db_get_xml_from_file (p_file_name, p_directory)
    ID VARCHAR2 COLUMNS (32) PATH '@id '.
    , englishname PATH VARCHAR2 (50) '@englishName '.
    , status VARCHAR2 (10) PATH '@status '.
    )

    Any help will be much appreciated

    Thank you

    Dave

    user12036327 wrote:
    I use a query like this that seems to work to get all the attributes of table or all attributes of code element element, but not the code attributes in the context of his record from the table parent.

    To get the nested data, that you need to implement nested xmltable statements. for example

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
      3    
      4      
      5        
      6        
      7        
      8      
    9 10 11 12 13
    14
    15
    ') as xml from dual) 16 -- 17 -- end of sample data 18 -- 19 select tbl.id tbl_id 20 ,tbl.englishname as tbl_englishname 21 ,tbl.issystem as tbl_issystem 22 ,tbl.status as tbl_status 23 ,cd.id as cd_id 24 ,cd.englishname as cd_englishname 25 ,cd.code as cd_code 26 ,cd.status as cd_status 27 from t 28 ,xmltable(xmlnamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dataset-cv"), 29 '/dataset-cv:dataset-cv/lov/table' 30 passing t.xml 31 columns id varchar2(32) path '/table/@id' 32 ,englishname varchar2(20) path '/table/@englishName' 33 ,issystem varchar2(5) path '/table/@isSystem' 34 ,status varchar2(10) path '/table/@status' 35 ,code xmltype path '.' 36 ) tbl 37 ,xmltable(xmlnamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dataset-cv"), 38 '/table/code' 39 passing tbl.code 40 columns id varchar2(32) path '/code/@id' 41 ,englishname varchar2(20) path '/code/@englishName' 42 ,code number path '/code/@code' 43 ,status varchar2(10) path '/code/@status' 44* ) cd SQL> / TBL_ID TBL_ENGLISHNAME TBL_I TBL_STATUS CD_ID CD_ENGLISHNAME CD_CODE CD_STATUS -------------------------------- -------------------- ----- ---------- -------------------------------- -------------------- ---------- ---------- 00000000000001000 System Role true Enabled 00000000000000306 Helpdesk 1 Enabled 00000000000001000 System Role true Enabled 000000000000000307 Reviewer 2 Enabled 00000000000001000 System Role true Enabled 00000000000000308 Administrator 3 Enabled 00000000000002000 Country false Enabled 000000000000002004 AFGHANISTAN 4 Enabled 00000000000002000 Country false Enabled 000000000000002008 ALBANIA 8 Enabled 00000000000002000 Country false Enabled 000000000000002010 ANTARCTICA 10 Enabled 6 rows selected.
  • XML query returns empty when tags no data

    Hi all

    I have a problem that I can't solve.

    I have the following query:
     select
                xmlelement
                (
                   "users",
                   xmlagg
                   (
                      xmlelement
                      (
                         "user",
                         xmlelement
                         (
                            "username",
                            e.pin
                         ),
                         xmlagg
                         (
                            xmlelement
                            (
                               "details",
                               xmlforest
                               (
                                  e.password as "password"
                                 ,e.first_name as "forename"
                                 ,e.surname as "surname"
                                 ,'0' as "retired"
                                 ,e.email_address as "email"
                                 ,e.telephone_number as "phone"
                                 ,'No External Ref' as "externalRef"
                                 ,add_months(sysdate,+60) as "expiryDate"
                               )
                            )
                         )
                      )
                   )
                ) xml_out
             from   aqaost_examiners e
             group by e.pin;
    The query returns the XML code in the desired structure.

    But the problem I have is that when there is no data found by the query, I always get a single row returned by the following: < user > < / users >

    I tried so many things to try to have the query return nothing if there is no data available, but I can't do without something else goes wrong (to mess up the XML structure, etc.).

    Please is - can anyone help or point me in the right direction?

    I thank very you much in advance!

    Robin

    Hello

    Peter,

    This is the GROUP that does this.

    Actually no, the GROUP BY refers to the deepest XMLAgg and is required if e.pin is not unique.

    Let it out, and you also seem to have of many XMLAGG (?)

    That's assuming that e.pin is unique within the table (which is probably a fair assumption in this case).

    In fact, the behavior comes from the XMLAgg in the foreground:

    SQL> select xmlelement("users",
      2           xmlagg(
      3             xmlelement("user",
      4               xmlelement("username", e.empno)
      5             , xmlelement("details",
      6                 xmlforest(
      7                   e.ename as "name"
      8                 , e.job as "job"
      9                 )
     10               )
     11             )
     12           )
     13         ) xml_out
     14  from scott.emp e
     15  where 1 = 0
     16  ;
    
    XML_OUT
    -------------------------------------
    
     
    

    As with other global functions (such as SUM or AVG) adding a GROUP OF 'something' solves the problem:

    SQL> select xmlelement("users",
      2           xmlagg(
      3             xmlelement("user",
      4               xmlelement("username", e.empno)
      5             , xmlelement("details",
      6                 xmlforest(
      7                   e.ename as "name"
      8                 , e.job as "job"
      9                 )
     10               )
     11             )
     12           )
     13         ) xml_out
     14  from scott.emp e
     15  where 1 = 0
     16  group by null
     17  ;
    
    no rows selected
    

    Robin,
    So the more intimate XMLAgg is really necessary, you can use a subquery:

    select xmlelement("users", v.users)
    from (
      select xmlagg(
               xmlelement("user",
                 xmlelement("username", e.empno)
               , xmlagg(
                   xmlelement("details",
                     xmlforest(
                       e.ename as "name"
                     , e.job as "job"
                     )
                   )
                 )
               )
             ) as users
      from scott.emp e
      group by e.empno
    ) v
    where v.users is not null
    ;
    
  • Take the substring of the value returned by REGEXP_SUBSTR

    I haven't used regular expressions really before and tried to do some reading on how it works.

    Im trying to parse a string to pull a specific value.

    Using an example, I found from Oracle, I could find something that is very close to what I want to do, but it includes the delimiter character, and I can't seem to find a way to get rid of it.

    For example

    SELECT REGEXP_SUBSTR ('COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ': [^,] +', 1.1) RESULT
    FROM DUAL;

    The result: 88

    It changes a little

    SELECT REGEXP_SUBSTR ('COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ': [^,] +', 1.2) RESULT
    FROM DUAL;

    I got a return of: 12345678

    Which is basically what I want, I want to be able to extract the values between the ': 'and the','

    The values can vary in length, so I spread using the substr function.

    If anyone knows how I can get just the digital output without the extra ':' face?

    Very much appreciated...

    Why not use substr with regexp_substr:

    SELECT SUBSTR (REGEXP_SUBSTR ("COUNT: 88, NUMBER: 12345678, LICENSE: 123456789', ' LICENSE: [^,] +'1, 1"), 9) RESULT
    FROM DUAL;

    Result:
    123456789

    I recommend that you do not simply include him ': ' but also the whole, Word such as "LICENSE:

  • How to extract the values of XMLTYPE column,

    SQL > create table temporary global xmtype_tab (xmlfile xmltype);

    SQL > select * from all_directories;

    SYS RESTOREDIR/home / / dbimptask /.

    insert into xmtype_tab values (xmltype (dbms_xslprocessor.read2clob ('RESTOREDIR ','LAS_SETUP.xml ')));

    1 line of creation.

    SQL > select * from xmtype_tab;

    XMLFILE
    --------------------------------------------------------------------------------
    <? XML version = "1.0"? >
    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >


    How to extract the values inside each tag?


    XML file has the following data...


    rowset <>
    < ROW >
    < DATA_CAPTURE_ON > 1 < / DATA_CAPTURE_ON >
    < > 9600 BAUD_RATE < / BAUD_RATE >
    < ACK_TIMEOUT > 1 < / ACK_TIMEOUT >
    < TUBE_TRAVEL_LIMIT > 4 < / TUBE_TRAVEL_LIMIT >
    < SEND_SID_TIMEOUT > 1 < / SEND_SID_TIMEOUT >
    < INDEX_Q_TIMEOUT > 2 < / INDEX_Q_TIMEOUT >
    < HW_HANDSHAKING > 1 < / HW_HANDSHAKING >
    < / ROW >
    < / LINES > ';

    I use the Oracle 10.2.0.3 version...

    Why does this work?

    You are missing the tag of the ROWSET:

    select extractvalue (xmlfile, '/ROWSET/ROW/BAUD_RATE') baud_rate
      from xmltype_tab
     where existsnode (xmlfile, '/ROWSET/ROW/BAUD_RATE') = 1;
    
  • Profile of user - purchase - returns nothing

    I created a user profile in the Oracle Applications Sub - application developer

    Application: purchase
    Profile name: PO: CHANGE of SBM
    Type of hierarchy: security
    Validation of SQL:
    SQL = "select decode (meaning,".
    "Yes',"Full. "
    'No', 'None') \"Access Level\ «,»
    lookup_code
    in: visible_option_value,: profile_option_value
    of fnd_lookups
    where lookup_type = 'YES_NO '.

    Now, I am trying to run this query that returns nothing. Is it because I have the application level * purchase *.

    {code}
    Select apps.fnd_profile.value ('PO: SBM CHANGE ') twice;
    {code}

    Thank you

    Hello

    First you need to get the values of this profile option (resp. system administrator > profile > system).
    In addition, when you use fnd_profile.value, you must specify the option of internal profile name and not the name of user profile option (maybe they are the same in your case?).
    And also, in general, you need to specify your context before calling fnd_profile. You can use fnd_global.apps_initialize to do this.

    It will be useful.

  • Extract XML with xmlns duble truble, 9i database data

    Hello

    I have a problem extracting the data from the example:

    My xml file:
    <? XML version = "1.0" encoding = "UTF-8"? >
    < document xmlns = "http://www.crea.si/Schemas/2004/Document/ZbsXml" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "http://www.crea.si/Schemas/2004/Document/ZbsXml ZbsCreaDoc.xsd" >
    < data >
    < DataFormat >
    text/xml, < MimeType > < / MimeType >
    < / DataFormat >
    < content >
    < EmbeddedData >
    < Paket xmlns = "http://www.zbs-giz.si/Schemas/2006/ZbsXml" >
    < VodilniZapis >
    < StevilkaRacuna > 00000000 < / StevilkaRacuna >
    < StevilkaPaketa > 0000 < / StevilkaPaketa >
    < DatumPaketa > 0000 - 00 - 00 < / DatumPaketa >
    < / VodilniZapis >
    < / Paket >
    < / EmbeddedData >
    < / content >
    < / data >
    < / document >

    my selection:
    SELECT extractValue (Value (t), ' VodilniZapis/StevilkaPaketa', 'xmlns = "http://www.crea.si/Schemas/2004/Document/ZbsXml" ') MimeType
    TABLE (XMLSequence (extract (xm, ' / Document/data/content/EmbeddedData/package/VodilniZapis ',' xmlns = "http://www.crea.si/Schemas/2004/Document/ZbsXml" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" '))) t;

    It does not work except that it I use only one < package > instead of < Paket xmlns = "http://www.zbs-giz.si/Schemas/2006/ZbsXml" >


    Anyopne help me? Thank you.

    Hello

    Since the element child "Paket" comes from another namespace, you must qualify (and its descendants) in the XPath expression.

    Something like this should do it:

    SELECT extractValue(value(t), 'VodilniZapis/StevilkaPaketa', 'xmlns="http://www.zbs-giz.si/Schemas/2006/ZbsXml"') mimetype
    FROM TABLE(
      XMLSequence(
        extract( xml, '/Document/Data/Content/EmbeddedData/ns2:Paket/ns2:VodilniZapis',
                 'xmlns="http://www.crea.si/Schemas/2004/Document/ZbsXml",
                  xmlns:ns2="http://www.zbs-giz.si/Schemas/2006/ZbsXml"' )
      )
    ) t;
    
  • Extract XML - Namespace question

    Hello
    I try to extract a value from an xml element, but it does not work when I put the name space.
    The following XML code:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < nfeProc xmlns = "http://www.portalfiscal.inf.br/nfe" xmlns:ds = "http://www.w3.org/2000/09/xmldsig#" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" versão "1.10" = >
    < NFe xmlns = "http://www.portalfiscal.inf.br/nfe" >
    < infNFe Id = versão "1.10" = "NFe35100492754738007094550010000418641120612904" >
    < ide >
    < cUF > 35 < / cUF >
    < cNF > 112061290 < / cNF >
    < natOp > COMPRA PARA COMERCIALIZACAO DEVOLUCAO < / natOp >
    < indPag > 0 < / indPag >
    < mod > 55 < / mod >
    < set > 1 < / series >
    < naturist > 41864 < / naturist >
    < a half > 2010 - 04 - 26 < / half >
    < dSaiEnt > 2010 - 04 - 26 < / dSaiEnt >
    < tpNF > 1 < / tpNF >
    < cMunFG > 3548708 < / cMunFG >
    < tpImp > 1 < / tpImp >
    < tpEmis > 1 < / tpEmis >
    < VAC > 4 < / cDV >
    < tpAmb > 2 < / tpAmb >
    < finNFe > 1 < / finNFe >
    < procEmi > 0 < / procEmi >
    < verProc > 1.0 < / verProc >
    < / ide >
    < / infNFe >
    < / CHILD >
    < / nfeProc >


    But this XML file is a BLOB in a table that I converted to CLOB and after to XMLTYPE.
    And here is the SQL code that I am trying to run:

    Select extract (column_value,'cUF / text () ') AS 'XML ELEMENT.
    of (xmltype (blob_to_clob (fl_l.file_data)) select media_data_clob)
    of fnd_attached_documents fad_l
    fnd_documents_tl fdt_l
    fnd_lobs fl_l
    where fad_l.document_id = fdt_l.document_id
    and fdt_l.media_id = fl_l.file_id
    and fdt_l.language = 'PTB '.
    and fad_l.entity_name = 'NFe_iSupplier') myxml.
    table (xmlsequence (Extract (media_data_clob, '//cUF'))) t;


    Can someone help me?

    Thank you!

    Hello

    You must add a namespace clause the extract() function.

    table example (xmlsequence (extract (media_data_clob,'/ / EUC ',' xmlns = http://www.portalfiscal.inf.br/nfe')))

    HTH,

    Chris

  • Extract XML question

    Hello

    I have the XML code below in a table (configbom) that has a column (DATA) that is XMLTYPE. I try to extract the value of State via SQL in SQLPLUS like this:


    SQL > Select extract(data,'/ConfigBomRequestResponse/ConfigBomRequestResult/StatusCode') from configbom;

    EXTRACT(DATA,'/CONFIGBOMREQUESTRESPONSE/CONFIGBOMREQUESTRESULT/STATUSCODE')
    --------------------------------------------------------------------------------


    SQL >

    I didn't recover. Does anyone have any ideas what I am doing wrong?

    Thank you
    Melinda



    < ConfigBomRequestResponse xmlns = "http://swagelok.com/service/tibco/2009/09/03" >
    < ConfigBomRequestResult xmlns:i = "http://www.w3.org/2001/XMLSchema-instance" >

    < StatusCode > 0 < / StatusCode >
    < StatusMessage / >
    < BomResults >

    < ConfigBomData >
    < allocation_length i: nil = "true" / >
    < cut_length
    i: Nil = "true" / >
    < description > FL UNDER ASSEMBLY < / description >

    < part_number > SS-FL4B-C-RF4SA < / part_number >

    < quantity_per > 2 < / quantity_per >
    < i: Nile uom = "true" / >

    < / ConfigBomData >
    < ConfigBomData >

    < allocation_length > 33,84 < / allocation_length >

    < cut_length > 33,84 < / cut_length >
    < description > 1 / 4 & quot; TUBE & amp;
    BRAID < / description >
    < part_number > SS-FL4-B-HXX < / part_number >

    < quantity_per i: nil = "true" / >
    IN < Glu > < / UDM >
    < / ConfigBomData >

    < / BomResults >
    < / ConfigBomRequestResult >
    < / ConfigBomRequestResponse >

    Hi, Melinda,

    two things: first of all, you can set the column in the table by using a table alias. This is necessary because the column is a type of object-orientation that should be treated by a Manager.
    Then, you must pass in the namespace of the element. In otherwise, extract tent to search in the default namespace contains all values at all. As a result, your query should look like this:


    select extract(x.data,
    '/ConfigBomRequestResponse/ConfigBomRequestResult/StatusCode',
    'xmlns="http://swagelok.com/service/tibco/2009/09/03"')
    from configbom x;

    Best regards

    Jürgen

Maybe you are looking for

  • How to duplicate an existing tab?

    I often need to duplicate a tab, but I can't do quickly in Firefox. I can copy the link, open a new tab and paste the link, but a simple shortcut in the menu "right click" tabs would be nice. IE8 has this feature (Ctrl + K).

  • When I try to burn a DVD it say wait for pilot but it never happens

    Is there a way to tell if your burner is circled?

  • YOGA 10 gel - factory reset does not

    I have my Tablet 10 YOGA for two weeks and today the Lenovo logo is on the screen. I have followed the reset factory still that the logo that appears. I chose Reboot factory Then select clear memory However when selected restart just the Lenovo logo

  • my sex cam dell vostro 1500 is not working or projection in Device Manager

    my sex cam dell vostro 1500 is not working or showing in the Device Manager, my cyberlink ucam tells me that there is no deevice of captuing. I really don't understand because the built-in webcam or imaging is supposed to show in the Device Manager,

  • Update interrupted - now cannot start Windows

    Hello Completely new to this forum and in the world of the system recovery / technical questions will therefore be very grateful for any help that you can offer but please keep clear answers. I am running windows 7 on a Samsung laptop about 3 years.