ORA-19279: XPTY0004 - dynamic XQuery type mismatch

Hi all
When I run select it below the statement I had the "ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element" oracle error.
select valtag 
  from XMLTABLE( '/root'
                 passing XMLTYPE('<root>
                                              <subroot><valtag>6666446612</valtag></subroot>
                                              <subroot><valtag>6666446613</valtag></subroot>
                                  </root>'
                                 ) 
                Columns
                      valtag varchar(20) path 'subroot/valtag'
               ) s
required result:
VALTAG
---------------
6666446612
6666446613
Please let me know where I made the mistake?

Thank you
RAM.

Published by: Rama Krishna.CH on November 26, 2012 15:48

Please let me know where I made the mistake?

The main manifestation of XQuery (here = ' / root ') defines what will be the relational lines based on the result set.
(Strictly speaking, this expression must return a sequence of elements)

Here, so you want the element subroot be your 'line':

SQL> select s.valtag
  2  from XMLTABLE( '/root/subroot'
  3         passing XMLTYPE('
  4             6666446612
  5             6666446613
  6           ')
  7         Columns
  8            valtag varchar(20) path 'valtag'
  9       ) s
 10  ;

VALTAG
--------------------
6666446612
6666446613
 

Tags: Database

Similar Questions

  • ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element

    Hello

    Can you please help me by questioning from the following XML code.

    under query works for the 1 iteration. but for several games I get following error.

    ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element

    19279 00000 - "dynamic XQuery type mismatch: expected - singleton sequence got several sequence element.

    * Cause: The sequence of XQuery passed was more than one element.

    * Action: Fix the XQuery expression to return a single element of the sequence.

    Help, please

    Select X.*

    ABC evt

    , XMLTABLE (XMLNAMESPACES ('urn:swift:xsd:mtmsg.2011' AS NS2, DEFAULT 'urn:swift:xsd:fin.970.2011'),

    "$msg_xml" by PASSING EVT.col1 as 'msg_xml '.

    COLUMNS

    Path Varchar (40) F61ValueDate "/ F61/ValueDate [1]."

    Path of DebitCreditMark Varchar (40) "/ / Document/MT970/F61a/F61/DebitCreditMark [1]."

    Amount Varchar (40) path ' / / Document/MT970/F61a/F61/amount [1]. "

    Path of TransactionType Varchar (40) "/ / Document/MT970/F61a/F61/TransactionType [1]."

    Path of IdentificationCode Varchar (40) "/ / Document/MT970/F61a/F61/IdentificationCode [1]."

    Path of ReferenceForTheAccountOwner Varchar (40) "/ / Document/MT970/F61a/F61/ReferenceForTheAccountOwner [1]."

    Path of SupplementaryDetails Varchar (40) "/ / Document/MT970/F61a/F61/SupplementaryDetails [1].

    ) X

    where EVT.col2 = 2

    < FinMessage xmlns = "urn:swift:xsd:mtmsg.2011" xmlns:FinMessage ="urn:swift:xsd:mtmsg.2011" > "
    < Block1 >
    < ApplicationIdentifier > F < / ApplicationIdentifier >
    < ServiceIdentifier > 01 < / ServiceIdentifier >
    < LogicalTerminalAddress > IRVTDEFXAXXX < / LogicalTerminalAddress >
    < open > 5252 < / open >
    < SequenceNumber > 699163 < / SequenceNumber >
    < / Block1 >
    < Block2 >
    < OutputIdentifier > O < / OutputIdentifier >
    < > 970 MessageType < / MessageType >
    < > 1633 InputTime < / InputTime >
    < MessageInputReference >
    < date > 131101 < / Date >
    < LTIdentifier > EBASBEBBQ < / LTIdentifier >
    < BranchCode > XXX < / BranchCode >
    < open > 1113 < / open >
    < n > 070016 < / ISN >
    < / MessageInputReference >
    < date > 131101 < / Date >
    < time > 1634 < / Time >
    < MessagePriority > N < / MessagePriority >
    < / Block2 >
    < Block3 >
    ENS0000857017566 < F108 > < / F108 >
    < / Block3 >
    < canton4 >
    < xmlns = "urn:swift:xsd:fin.970.2011 document" xmlns:Document ="urn:swift:xsd:fin.970.2011" > "
    < MT970 >
    < F20a >
    ENS17566/END of < F20 > < / F20 >
    < / F20a >
    < F25a >
    < F25 > IRVTDEFX/EUR/131101/N < / F25 >
    < / F25a >
    < F28a >
    < F28C >
    < StatementNumber > 215 < / StatementNumber >
    < SequenceNumber > 16 < / SequenceNumber >
    < / F28C >
    < / F28a >
    < F60a >
    < F60M >
    < DCMark > D < / DCMark >
    < date > 131101 < / Date >
    < currency > EUR < / currency >
    < amount > 2686836,28 < / amount >
    < / F60M >
    < / F60a >
    < F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 40248, < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 103 < / IdentificationCode >
    < ReferenceForTheAccountOwner > FX5445414 < / ReferenceForTheAccountOwner >
    < SupplementaryDetails > KREDBEBBXXXIRVTDEFXXXXN011031 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 41605, < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 103 < / IdentificationCode >
    < ReferenceForTheAccountOwner > FX5443846 < / ReferenceForTheAccountOwner >
    < SupplementaryDetails > DEUTDEFFXXXIRVTDEFXXXXN011031 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 43730, < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 103 < / IdentificationCode >
    < ReferenceForTheAccountOwner > C13110130526301 < / ReferenceForTheAccountOwner >
    < SupplementaryDetails > BARCGB22XXXIRVTDEFXXXXN011033 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 58000, < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 202 < / IdentificationCode >
    < ReferenceForTheAccountOwner > FXT1311010000500 < / ReferenceForTheAccountOwner >
    < ReferenceOfTheAccountServicingInstitution > FXT1311010000500 < / ReferenceOfTheAccountServicingInstitution >
    < SupplementaryDetails > BKAUATWWXXXIRVTDEFXXXXN011116 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 59826,21 < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 103 < / IdentificationCode >
    < ReferenceForTheAccountOwner > FX5446070 < / ReferenceForTheAccountOwner >
    < SupplementaryDetails > CHASGB2LXXXIRVTDEFXXXXN011031 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F61a >
    < F61 >
    < valueDate > 131101 < / ValueDate >
    < DebitCreditMark > D < / DebitCreditMark >
    < amount > 60309,4 < / amount >
    < TransactionType > S < / TransactionType >
    < IdentificationCode > 103 < / IdentificationCode >
    < ReferenceForTheAccountOwner > 01987HS016415 < / ReferenceForTheAccountOwner >
    < SupplementaryDetails > EFGBGRAAXXXIRVTDEFXXXXN011458 < / SupplementaryDetails >
    < / F61 >
    < / F61a >
    < F62a >
    < F62M >
    < DCMark > D < / DCMark >
    < date > 131101 < / Date >
    < currency > EUR < / currency >
    < amount > 3736765,9 < / amount >
    < / F62M >
    < / F62a >
    < / MT970 >
    < / document >
    < / canton4 >
    < / FinMessage >

    Thank you

    Siva Prakash

    under query works for the 1 iteration. but for several games I get following error.

    When you want to present the groups repeating in relational format, you must extract the sequence of elements of the main XQuery expression.

    Each element is then spent the COLUMNS clause to be more shredded into columns.

    This should work as expected:

    Select x.*

    ABC t

    xmltable)

    XmlNamespaces)

    default 'urn:swift:xsd:fin.970.2011 '.

    , 'urn:swift:xsd:mtmsg.2011' as 'ns0 '.

    )

    , ' / ns0:FinMessage / ns0:Block4 / Document/MT970/F61a/F61 '

    in passing t.col1

    columns F61ValueDate Varchar (40) Path 'ValueDate '.

    , Path of the DebitCreditMark Varchar (40) "DebitCreditMark".

    , Varchar (40) path 'Amount' rise

    , Path TransactionType Varchar (40) "TransactionType".

    , Path of the IdentificationCode Varchar (40) "IdentificationCode".

    , Path of the ReferenceForTheAccountOwner Varchar (40) "ReferenceForTheAccountOwner".

    , Path of the SupplementaryDetails Varchar (40) "SupplementaryDetails".

    ) x ;

  • ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected singleton GL entry

    Hello
    My version of db: database Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    I run this code:
        SELECT *
        FROM XMLTABLE (
            '/rowset/row/businessgroups'
            PASSING XMLPARSE (DOCUMENT '<?xml version="1.0"?>
    <rowset>
    <row>
    <model>xt100</model>
    <businessgroups>
      <businessgroup>retail</businessgroup>
      <businessgroup>restaurant</businessgroup>
    </businessgroups>
    </row>
    </rowset>')
            COLUMNS businessgroup VARCHAR2(30) PATH 'businessgroup')
    
    error:
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    The error is coming as I walked him several elements in the xml file.
    Is it possible to modify the code to get a list of the businessgroups, as below
    output:
    retail
    restaurant
    If I make a few changes in the code, I get the output as below, but I want as above:
    retailrestaurant
    Please advice.
    Connected to Oracle Database 11g Enterprise Edition Release 11.1.0.7.0
    Connected as apps
    
    SQL>
    SQL> SELECT *
      2      FROM XMLTABLE (
      3          '/rowset/row/businessgroups'
      4          PASSING XMLPARSE (DOCUMENT '
      5  
      6  
      7  xt100
      8  
      9    retail
     10    restaurant
     11  
     12  
     13  ')
     14          COLUMNS businessgroup VARCHAR2(30) PATH 'businessgroup')
     15  /
    
    SELECT *
        FROM XMLTABLE (
            '/rowset/row/businessgroups'
            PASSING XMLPARSE (DOCUMENT '
    
    
    xt100
    
      retail
      restaurant
    
    
    ')
            COLUMNS businessgroup VARCHAR2(30) PATH 'businessgroup')
    
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    
    SQL>
    SQL>
    SQL> SELECT *
      2      FROM XMLTABLE (
      3          '/rowset/row/businessgroups/businessgroup'
      4          PASSING XMLPARSE (DOCUMENT '
      5  
      6  
      7  xt100
      8  
      9    retail
     10    restaurant
     11  
     12  
     13  ')
     14          COLUMNS businessgroup VARCHAR2(30) PATH '.')
     15  /
    
    BUSINESSGROUP
    ------------------------------
    retail
    restaurant
    
    SQL> 
    
  • Dynamic XQuery Type mismatch (ORA-19279)

    Hello

    I'm "ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element" error with the XML block below. Query works well when there is no repeating element XML block (address, income and phone). In addition, the query looks good from a performance perspective?

    with the trial as (select xmltype

    ("" < SampleRequest = xmlns:ns0 "http://abc.org/SampleRequest/one" xmlns ="http://abc.org/SampleRequest/one" > ")

    < ns0:Address >

    < ns0:AddressType >

    < CurrAdrInd xmlns = "" > Y < / CurrAdrInd >

    < OutOfAreaInd xmlns = "" > N < / OutOfAreaInd >

    < YearDur xmlns = "" > 15 < / YearDur >

    < MthDur xmlns = "" > 0 < / MthDur >

    < / ns0:AddressType >

    < AdrLine1 xmlns = "" > line 1 < / AdrLine1 >

    < AdrLine2 xmlns = "" > line 2 < / AdrLine2 >

    < AdrLine3 xmlns = "" > line 3 < / AdrLine3 >

    < Name xmlns = "" > city < / name >

    < PostCd xmlns = "" > 123456 < / PostCd >

    < / ns0:Address >

    < ns0:Address >

    < ns0:AddressType >

    < CurrAdrInd xmlns = "" > N < / CurrAdrInd >

    < OutOfAreaInd xmlns = "" > Y < / OutOfAreaInd >

    < YearDur xmlns = "" > 5 < / YearDur >

    < MthDur xmlns = "" > 0 < / MthDur >

    < / ns0:AddressType >

    < AdrLine1 xmlns = "" > line 1 < / AdrLine1 >

    < AdrLine2 xmlns = "" > line 2 < / AdrLine2 >

    < AdrLine3 xmlns = "" > line 3 < / AdrLine3 >

    < Name xmlns = "" > city < / name >

    < PostCd xmlns = "" > 987654 < / PostCd >

    < / ns0:Address >

    < ns0:Customer >

    < TitleCd xmlns = "" > Mr < / TitleCd >

    < FrstName xmlns = "" > customer 1 < / FrstName >

    < midName xmlns = "" / >

    < name xmlns = "" > LAST < / LastName >

    < BrthDt xmlns = "" > 1979-06-21 < / BrthDt >

    < / ns0:Customer >

    < ns0:Income >

    < IncmTypeCd xmlns = "" > gross < / IncmTypeCd >

    < IncmAmt xmlns = "" > 2700 < / IncmAmt >

    < / ns0:Income >

    < ns0:Income >

    < IncmTypeCd xmlns = "" > other < / IncmTypeCd >

    < IncmAmt xmlns = "" > 1500 < / IncmAmt >

    < / ns0:Income >

    < ns0:Telephone >

    < PhnNumTypeCd xmlns = "" > home < / PhnNumTypeCd >

    < PhnAreaCd xmlns = "" > 123 < / PhnAreaCd >

    < PhnNum xmlns = "" > 123467 < / PhnNum >

    < / ns0:Telephone >

    < ns0:Telephone >

    < PhnNumTypeCd xmlns = "" > work < / PhnNumTypeCd >

    < PhnAreaCd xmlns = "" > 987 < / PhnAreaCd >

    < PhnNum xmlns = "" > 9876543 < / PhnNum >

    < / ns0:Telephone >

    < / SampleRequest >

    clob_xml') of double)

    Select x.* from the test,

    XMLTable (xmlnamespaces ('http://abc.org/SampleRequest/one' as "ns0"),)

    ' for $i in /ns0:SampleRequest

    Return $i' from clob_xml

    columns

    path of varchar2 (10) ttl_cd ' / / ns0:Customer / TitleCd',

    path of varchar2 (32) frst_nm ' / / ns0:Customer / FrstName ",

    path of varchar2 (1) mid_nm ' / / ns0:Customer / MidName',

    "path of varchar2 (32) last_nm ' / / ns0:Customer / LastName."

    date path brth_dt ' / / ns0:Customer / BrthDt',

    path of varchar2 (1) curr_adr_ind ' / / ns0:Address / ns0:AddressType / CurrAdrInd',

    path of varchar2 (1) out_of_area_ind ' / / ns0:Address / ns0:AddressType / OutOfAreaInd',

    path number (3) tm_at_adr_year_dur ' / / ns0:Address / ns0:AddressType / YearDur',

    path number (2) tm_at_adr_mth_dur ' / / ns0:Address / ns0:AddressType / MthDur',

    path of varchar2 (32) flat_num ' / / ns0:Address / AdrLine1',

    path of varchar2 (32) hse_num ' / / ns0:Address / AdrLine2',

    path of varchar2 (32) hse_nm ' / / ns0:Address / AdrLine3',

    path of varchar2 (32) town_nm ' / / ns0:Address / name ',

    path of varchar2 (8) post_cd ' / / ns0:Address / PostCd',.

    path of varchar2 (1) incm_type_cd ' / / ns0:Income / IncmTypeCd',

    path number (10) incm_amt ' / / ns0:Income / IncmAmt',

    path of varchar2 (2) phn_num_type_cd ' / / ns0:Telephone / PhnNumTypeCd',

    path of varchar2 (5) phn_num_area_cd ' / / ns0:Telephone / PhnAreaCd',

    path of varchar2 (12) phn_num ' / / ns0:Telephone / PhnNum'

    ) x ;

    Kind regards

    Chandra KenR

    Thanks, that's much clearer this way.

    For example, to retrieve information related to income:

    SQL > select x.*

    tmp_xml 2 t

    3, xmltable)

    4 xmlnamespaces ('http://abc.org/SampleRequest/one' as "ns0")

    5, ' / ns0:SampleRequest'

    6 passage t.object_value

    7 columns

    8 path of varchar2 (10) ttl_cd ' ns0:Customer / TitleCd'

    "9 road to varchar2 (32) frst_nm ' ns0:Customer / FrstName"

    10 road of varchar2 (1) mid_nm ' ns0:Customer / MidName'

    "11 road of varchar2 (32) last_nm ' ns0:Customer / LastName"

    12, date of brth_dt path ' ns0:Customer / BrthDt'

    13, path number (10) grs_incm_amt ' ns0:Income [IncmTypeCd = "Raw"] / IncmAmt'

    14 road number (10) oth_incm_amt ' ns0:Income [IncmTypeCd = 'Other'] / IncmAmt'

    (15) x

    16;

    TTL_CD FRST_NM MID_NM LAST_NM BRTH_DT GRS_INCM_AMT OTH_INCM_AMT

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

    Mr. customer 1 LAST 21/06/1979 2700-1500

    On your question about performance:

    Yes, there are some general guidelines to follow to get the best performance of the execution of XQuery.

    Those are the storage dependent and independent storage, with greater importance of the former.

    For example, in the test case above, I first stored the XML in a binary table of XMLType (TMP_XML): it is an optimization of storage-dependent.

    I also removed all the descendants axis (/ /) for path expressions: those who were not needed and should be avoided if the exact location of the target node is known, this is typically an independent optimization of storage.

    You will find everything you need to know in details here:

    http://www.Oracle.com/technetwork/database-features/xmldb/overview/xmldb-bpwp-12cr1-1964809.PDF

  • Dynamic XQuery type mismatch

    I have the following. How to avoid the dynamic type mismatch?

    < ResGuests >

    < ResGuest >

    profile of <>

    < ProfileInfo >

    < Type UniqueID = "21" ID = "3558" / >

    < profile >

    < TPA_Extensions >

    < TPA_Extension >

    < DRI_INFO MemberLevel = GuestType "s/o" = "GST" / > "

    < / TPA_Extension >

    < / TPA_Extensions >

    < customer >

    < PersonName >

    < name > Ws < / name >

    D. JAMES < GivenName > < / GivenName >

    < / PersonName >

    < / customer >

    < / profile >

    < / ProfileInfo >

    < ProfileInfo >

    < Type UniqueID = "21" ID = "3568" / >

    < profile >

    < TPA_Extensions >

    < TPA_Extension >

    < DRI_INFO MemberLevel = GuestType "s/o" = "Assistant Director General" / > "

    < / TPA_Extension >

    < / TPA_Extensions >

    < customer >

    < PersonName >

    < name > M < / name >

    < GivenName > GUY < / GivenName >

    < / PersonName >

    < / customer >

    < / profile >

    < / ProfileInfo >

    < / profile >

    < / ResGuest >

    < / ResGuests >

    SELECT lengthofstay

    boarding

    resvtype

    devices

    membertype

    IN n_lengthofstay

    n_amount_to_charge

    v_resvtype

    n_num_devices

    v_member_type

    FROM XMLTABLE)

    xmlnamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05'), ' / OTA_ResRetrieveRS'

    PASSAGE mxml

    COLUMNS lengthofstay VARCHAR2 (2000)

    Path "ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@LengthOfStay".

    TOLL number

    Path "ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@AmountBeforeTax".

    , resvtype VARCHAR2 (2000)

    Path "ReservationsList/HotelReservation/RoomStays/RoomStay/RoomRates/RoomRate/@BookingCode".

    Number of devices

    Path "ReservationsList/HotelReservation/Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@NumberConnections".

    , membertype VARCHAR2 (2000)

    Path "ReservationsList/HotelReservation/ResGuests/ResGuest/Profiles/ProfileInfo/Profile/TPA_Extensions/TPA_Extension/DRI_INFO/@MemberLevel");

    I would be able to extract the data in a given table?

    This is not really to the point.

    First, you must decide how to deal with the various nodes of type of repetition, we could meet in the XML file.

    If you want extract as a single flat tabular structure or rather as separate entity sets?

    If flattening is OK, then something like this will not work on your current sample XML:

    DECLARE
        x_xml          CLOB
            := '
    
       
       
          
       
       
          
             
             
                
                   
                      
                         
                      
                   
                
             
             
                
                   
                      
                         
                         
                            
                               
                                  
                               
                            
                            
                               
                                  Winters
                                  JAMES D.
                               
                            
                         
                      
                      
                         
                         
                            
                               
                                  
                               
                            
                            
                               
                                  M
                                  GUY
                               
                            
                         
                      
                   
                
             
             
                
                   
                   
                      
                         
                            
                         
                      
                   
                   
                
             
          
       
    ';
        mxml           XMLTYPE;
    
        TYPE data_rec IS RECORD
        (
            lengthofstay   NUMBER
           ,chargeable     NUMBER
           ,resvtype       VARCHAR2 (2000)
           ,devices        NUMBER
           ,membertype     VARCHAR2 (2000)
           ,guesttype      VARCHAR2 (2000)
        );
    
        TYPE results IS TABLE OF data_rec;
    
        a_results      results;
    
    BEGIN
        mxml        := xmltype (x_xml);
    
        SELECT x1.lengthofstay
             , x1.chargeable
             , x1.resvtype
             , x1.devices
             , x2.membertype
             , x2.guesttype
        BULK COLLECT INTO a_results
        FROM XMLTABLE (
               XMLNamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05')
             , '/OTA_ResRetrieveRS/ReservationsList/HotelReservation'
               PASSING mxml
               COLUMNS lengthofstay VARCHAR2(2000)  PATH 'Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@LengthOfStay'
                     , chargeable   NUMBER          PATH 'Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@AmountBeforeTax'
                     , resvtype     VARCHAR2(2000)  PATH 'RoomStays/RoomStay/RoomRates/RoomRate/@BookingCode'
                     , devices      NUMBER          PATH 'Services/Service/TPA_Extensions/TPA_Extension/WiFiFees/@NumberConnections'
                     , profiles     XMLType         PATH 'ResGuests/ResGuest/Profiles/ProfileInfo'
             ) x1
           , XMLTABLE (
               XMLNamespaces (DEFAULT 'http://www.opentravel.org/OTA/2003/05')
             , '/ProfileInfo/Profile/TPA_Extensions/TPA_Extension/DRI_INFO'
               PASSING x1.profiles
               COLUMNS memberType  VARCHAR2(2000)   PATH '@MemberLevel'
                     , guestType   VARCHAR2(2000)   PATH '@GuestType'
             ) x2 ;
    
        for i in 1 .. a_results.count loop
          DBMS_OUTPUT.put_line (   a_results(i).lengthofstay
                                || ' -->'
                                || a_results(i).chargeable
                                || ' -->'
                                || a_results(i).resvtype
                                || ' -->'
                                || a_results(i).devices
                                || ' -->'
                                || a_results(i).membertype
                                || ' -->'
                                || a_results(i).guesttype
                                );
        end loop;
    END;
    /
    

    output:

    5--> 0--> REN--> 4--> N / A--> GST

    5--> 0--> REN--> 4--> N / A--> ADG

    but as said, don't forget that it will fail as soon as there is more than one Service, ideal or RoomRate node.

  • ORA-19279: dynamic type mismatch query: wait for the singleton sequence

    Hello
    I have my xml stored in the table "xml_table".
    The content of the XML is:

    < COMPANY NAME = 'ABC' >
    Paris < DEPARTMENT_NAME > < / DEPARTMENT_NAME >
    < ADDRESS > Nevers Street < / ADDRESS >
    London < DEPARTMENT_NAME > < / DEPARTMENT_NAME >
    Northampton square < ADDRESS > < / ADDRESS >
    < / COMPANY >

    I would like to query the XML to get the result like this:

    COMPANY_NAME | DEPARTMENT_NAME | ADDRESS

    ABC | Paris | Street of nevers
    ABC | London | Northampton square

    However when I run the query:

    SELECT t.company_name, t.address, t.department_name
    Xml_table p,
    XMLTable ('/ COMPANY' ADOPTION p.OBJECT_VALUE)
    COLUMNS company_name PATH "@NAME."
    address PATH of VARCHAR2 (100) "/ COMPANY/ADDRESS.
    department_name PATH VARCHAR2 (100) "/ COMPANY/DEPARTMENT_NAME ') t

    I get the error message:
    ORA-19279: XPTY0004 - dynamic XQuery type mismatch: expected - singleton sequence got several sequence element

    What can be wrong with the query? Should Howe be modified to achieve the desired result?

    Thanks for the help

    Groxy

    Hello

    What can be wrong with the query?

    The XPath expression that you use to map DEPARTMENT_NAME and columns ADDRESS corresponds to a sequence of elements, not a single value.
    For example, "/ COMPANY/ADDRESS" means:

    Rue de nevers
    Northampton Square

    In fact, your XML structure is not very suitable for a relational presentation.
    IMO, it would be easier to deal with this form:

    
      
        Paris
        
    Rue de nevers
    London
    Northampton Square

    Like this, you can easily break SERVICE items in separate lines with a simple XPath.

    That being said, perhaps that you have no choice, so here's a query do you want:

    SELECT t.company_name, t.address, t.department_name
    FROM xml_table p,
         XMLTable(
          'for $i in /COMPANY/DEPARTMENT_NAME
           return 
           {
            $i/../@NAME,
            $i,
            $i/following-sibling::ADDRESS[1]
           }
           '
          PASSING p.OBJECT_VALUE
          COLUMNS company_name    VARCHAR2(30)  PATH '@NAME',
                  address         VARCHAR2(100) PATH 'ADDRESS',
                  department_name VARCHAR2(100) PATH 'DEPARTMENT_NAME'
         ) t
    ;
    

    Each 'virtual' line is built in the XQuery by searching for each DEPARTMENT_NAME and its first element following ADDRESS.

  • ORA-19279: dynamic type mismatch XQuery

    For the XML below, the XMLTABLE() is a failure. Please notify.

    < EMPTABLE >

    < EMPLOYEE ENAME = 'Scott' >

    < > 7844 EMPNO < / EMPNO >

    Manager < JOB > < / JOB >

    < SAL > 100000 < / SAL >

    < / EMPLOYEE >

    < EMPLOYEE ENAME = 'King' >

    < EMPNO > 100 < / EMPNO >

    President < JOB > < / JOB >

    < SAL > 200000 < / SAL >

    < / EMPLOYEE >

    < / EMPTABLE >

    SQL > SELECT inv_id, a.EMPName, a.EMPNO, a.Job, a.Sal

    2 FROM invoicexml_col,

    3 XMLTABLE ('/ EMPTABLE')

    4 in PASSING invoicexml_col.inv_doc

    5 COLUMNS

    6 EMPName varchar2 (10) PATH ' / EMPTABLE/EMPLOYEE/ENAME,

    7 EMPNO varchar2 (20) PATH ' / EMPTABLE/EMPLOYEE/EMPNO. "

    8 USE varchar2 (10) PATH ' / EMPTABLE/EMPLOYEE/JOB. "

    9 SAL varchar2 (10) PATH ' / EMPTABLE/EMPLOYEE/SAL.

    (10) a;

    SELECT inv_id, a.EMPName, a.EMPNO, a.Job, a.Sal

    *

    ERROR on line 1:

    ORA-19279: XQuery dynamic type mismatch: expected - singleton sequence had

    sequence of several element

    For the XML below, the XMLTABLE() is a failure. Please notify.

    My advice is: read the documentation to understand works XMLTable:

    http://docs.Oracle.com/database/121/ADXDB/xdb_xquery.htm#ADXDB5097

    You will also need to read a few tutorials XPath/XQuery generalist.

    The error comes because you try to project "stored" in a single column data because the main manifestation of XQuery is wrong.

    The main manifestation of XQuery (noted "XQuery_string" in the doc) is there to define the line template. These data 'line' are then cut into separate relational columns according to what is specified in the clause of COLUMNS:

    SQL> SELECT a.*
      2  FROM invoicexml_col
      3     , XMLTABLE('/EMPTABLE/EMPLOYEE'
      4       PASSING invoicexml_col.inv_doc
      5       COLUMNS
      6          EMPName varchar2(10) PATH '@ENAME'
      7       ,  EMPNO   varchar2(20) PATH 'EMPNO'
      8       ,  JOB     varchar2(10) PATH 'JOB'
      9       ,  SAL     number       PATH 'SAL'
     10       ) a;
    
    EMPNAME    EMPNO                JOB               SAL
    ---------- -------------------- ---------- ----------
    Scott      7844                 Manager        100000
    King       100                  President      200000
    
  • ORA-19279 with several children in XML

    Hi all

    I get this error:

    ORA-19279: XQuery dynamic type mismatch: expected - singleton sequence got several sequence element

    When you try to select an XML type.

    The XML looks like:
    <users>
      <user>
        <username>123456</username>
        <details>
          <password>password</password>
          <forename>Barry</forename>
          <surname>Donovan</surname>
          <retired>0</retired>
          <email>email.com</email><phone>9999-88880333</phone>
        </details>
        <assignedRoles>
          <EXAM_CODE>9999_4949</EXAM_CODE>
          <EXAM_CODE>8888_3838</EXAM_CODE>
        </assignedRoles>
      </user>
    </users>
    My SQL to query it is:
    SELECT
           h.pin
          ,d.password
          ,d.forename
          ,d.surname
          ,d.email
          ,d.phone
          ,d2.exam_code
          FROM
             robin_temp x,
             xmltable('users/user' passing
                xml COLUMNS
                    pin       varchar2(1000) path 'username'
                  , lineitem  xmltype        path 'details'
                  , lineitem2 xmltype        path 'assignedRoles') h,
             XMLTable('details' PASSING
                h.lineitem COLUMNS
                   password varchar2(1000) path 'password'
                  ,forename varchar2(1000) path 'forename'
                  ,surname  varchar2(1000) path 'surname'
                  ,email    varchar2(1000) path 'email'
                  ,phone    varchar2(1000) path 'phone') d,
             xmltable('assignedRoles' passing
                  h.lineitem2 columns
                  exam_code varchar2(1000) path 'EXAM_CODE' d2                   
    Basically, because there is the child < details > and the < assignedRoles > child, I get this error. But I don't know what we can do about it...

    I'm still trying to sort this issue, but so far no joy at all... I can't imagine that it's a rare thing, then someone can help?

    Thank you so much in advance.

    Robin

    And multiple details, something like that...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2    
      3      123456
      4      
    5 password 6 Barry 7 Donovan 8 0 9 email.com9999-88880333 10
    11 12 9999_4949 13 8888_3838 14 15
    16
    ') as xml from dual) 17 -- 18 -- end of test data 19 -- 20 select x.username 21 ,y.password 22 ,y.forename 23 ,y.surname 24 ,y.retired 25 ,y.email 26 ,z.exam_code 27 from t 28 ,xmltable('/users/user' 29 passing t.xml 30 columns username varchar2(20) path './username' 31 ,details xmltype path './details' 32 ,assignedroles xmltype path './assignedRoles' 33 ) x 34 ,xmltable('/details' 35 passing x.details 36 columns password varchar2(20) path './password' 37 ,forename varchar2(20) path './forename' 38 ,surname varchar2(20) path './surname' 39 ,retired number path './retired' 40 ,email varchar2(50) path './email' 41 ) y 42 ,xmltable('/assignedRoles/EXAM_CODE' 43 passing x.assignedroles 44 columns exam_code varchar2(20) path '.' 45* ) z SQL> / USERNAME PASSWORD FORENAME SURNAME RETIRED EMAIL EXAM_CODE -------------------- -------------------- -------------------- -------------------- ---------- -------------------------------------------------- -------------------- 123456 password Barry Donovan 0 email.com 9999_4949 123456 password Barry Donovan 0 email.com 8888_3838 SQL>
  • type mismatch between cursor fetch and into clause

    Hi all
    Let us, considering what follows in the 11g:
    create table TEST1
    (
      ID   NUMBER(38),
      COL1 NUMBER(38)
    )
    tablespace USERS
      pctfree 10
      initrans 1
      maxtrans 255;
    CREATE OR REPLACE TYPE t_test IS OBJECT
    (
       id NUMBER(38),
       col1 NUMBER(38)
    )
    ;
    CREATE OR REPLACE TYPE t_test_table IS TABLE OF t_test
    and...

    declare
    
    cursor c is select 10 as id, 20 as col1 from dual connect by level < 1000;
    
    v_data t_test_table;
    
    begin
      
    
    open c;
    loop
      fetch c bulk collect into v_data limit 100;
      
      
      forall i in 1..v_data.count
        insert /*+ append_values */ 
        into test1 
        values(v_data(i).id, v_data(i).col1);
        
      exit when c%notfound;  
    
    end loop;
    close c;
    
    end;
    When we execute the statement we received the error:
    ORA-06550: line 13, column 29:
    PLS-00386: type mismatch found at 'V_DATA' between FETCH cursor and INTO variables
    ORA-06550: line 13, column 3:
    PL/SQL: SQL Statement ignored
    I know that a possibility here is to change the V_DATA type as being the rowtype cursor... consider that I want to use the v_data data after a DML operations in other / something like cast iron table process.


    Any ideas?


    Thanks in advance,
    Alexander.

    Could you remove the indication (append_values) and see?

  • Plot multiple charts XY (dynamic data type)

    Hello world

    I searched but could not find the solution. I'm tracing several XY graphs with dynamic data type.

    I have here an example five 2D-arrays of X/axis Y to draw.

    I need them in dynamic data in order to trace in Diadem using Diadem protocol.vi.

    I get all the values of the X/Y axis as values Y.

    Any help is really appreciated,

    Yan.


  • run the vba without compiling vi gets error 13 type mismatch

    Hello

    I am trying to use VBA to access Agilent 33250 vi driver code.  I followed the examples in the forums, but I'm not sure why I get "Run Time error 13' type mismatch.

    Void LabVIEW()
    Protected String filepath
    Dim lvapp As Application
    Dim vi VirtualInstrument
    Dim ParamNames (0-1) As String
    Dim ParamVal (0-1) have varying

    Set lvapp = CreateObject ("LabVIEW.Application") ' create the connection to labview
    FilePath = "C:\Program NIUninstaller Instruments\LabVIEW 2013\instr.lib\Agilent Output.vi Series\Public\Action-Status\Enable 33XXX.
    VI the value is lvapp. GetVIReference (filepath) ' load vi

    ParamNames (0) = "VISA resource name.
    ParamNames (1) = "activate the output (T: Enable).

    ParamVal (0) = "GPIB0::10:INSTR".
    ParamVal (1) = True

    VI. FPWinOpen = True
    VI. call ParamNames, ParamVal

    lvapp. Quit smoking

    End Sub

    Any suggestions?

    Thank you

    I never called LabVIEW in VBA.   But I do not know LabVIEW and I do not know VBA.

    I see one of the two possibilities

    1. the string for the name of the resource does not work for the VISA resource setting or the Enable parameter do not like the real.

    2. are there that many order entry?  Do you need to assign a parameter and a value for each control on the Agilent VI?  I do not know.  Perhaps the VI guess just the default just as if you put a wire into a Subvi.

    # 1.  Break the smaller code.  First of all, just to make the VISA resource and comment the Enable parameter and value.  Then try again with the resource VISA and guided value and assign the parameter enable (0) and value (0).

    See if that one or if these two still triggers the error.

  • Document Type mismatch

    OfficeJet 6500 has (E710a):

    I try to print an envelope #10. Get 'Type Mismatch paper' every time.

    I measured the envelope, it is 4 1/8 "x 9 1/2".

    I tried several different programs, I get the same error every time.

    I understand the printer "scans" of the document that feeds, make sure that it corresponds to the selected paper type.  Is it possible that this "scanner" thingy is out of whack?

    == JJS ==

    Hello jimspy,

    I see that you are unable to print an envelope format #10, this "Paper mismatch" error is the case of any other format of print media? If this isn't the case, I would say that the censors are working well.

    I was able to find this document that can help: a 'paper Mismatch', or 'Paper Size Mismatch"Error Message displays when printing in Microsoft Word. Running HP and Scan Dr. impression may also be useful.

    Let me know if these suggestions help you.

  • FoxPro 9 error message. "Data type mismatch.

    Hello

    In front-end, when I opened a second menu there is an error message "data type mismatch. How can you fix this bug?

    Kind regards
    Esyrom

    [Moved from comments]

    Hello

    Try the FoxPro Forum

    http://social.msdn.Microsoft.com/forums/en-us/home?Forum=visualfoxprogeneral

    Don

  • Type mismatch runtime error 800a00d MSVBScript

    Title: MSVBScript original error

    Error: Type mismatch 800a00d to TIME MSVBScript error 'Open Conn' / includes/content_left to 11 asp.line

    Please respond to the * address email is removed from the privacy * I can not enter or find my main email account either. I've added files

    My each of my other accts containing in the newly created hotmail and I just can't find them. Windows says contact

    MS because they cannot fix.  I'm a newbie... Anyway this time I guess I can ask for that much help. I have

    know you people need EXACT wording error :)   If I need to fix it manually with your advice, remember pls I

    don't know much thing to do anything whatsoever.

    Hello

    1. what operating system is installed on the system?

    2. when exactly you get this error message?

    3. did you of recent changes to the system?

    4. Since when are you facing this problem?

    If you receive this error while browsing the Internet with Internet Explorer, then you can follow the steps below.

    (a) click the Start button

    (b) Select all programs

    (c) , click on Accessories

    (d) right-click on the command prompt

    (e) select run as administrator

    Type regsvr32 jscript.dll /u and press enter
    type regsvr32 jscript.dll , press enter
    type regsvr32/u vbscript.dll , and then press enter
    type regsvr32 vbscript.dll , and then press enter

    (f) close the command prompt and look for the question.

    See also:

    How to resolve script errors in Internet Explorer on Windows computers

    http://support.Microsoft.com/kb/308260

    If you have any problem with Hotmail, you can post the question on the link below for assistance.

    http://windowslivehelp.com/product.aspx?ProductID=1

  • Type mismatch and VI properties in 'for more specific classes.

    Dear all

    I have a Subvi trying to modify the properties of certain objects on the main pane of the front, in the example I have attached to this message it works well, but when I use the same Subvi in my main application which is a little bigger and has more hierarchical levels (that's why I join this one) it comes across some errors.

    Once running "to a more specific class' in the Sub - VI called ("MultpObj1N"), it gives this error that" LabVIEW: Type mismatch: object cannot be cast to the specified type.»

    I have no idea what could be the reason for this. Do you have any idea what it could be?

    Best regards

    Afshin

    Dear Darren

    Suddenly, I realized that my problem just happens to group objects (no cards) and like you said the type of data were different. Because I wanted to just access the visibility as you suggested, I've changed the strict form for normal and it worked.

    Thank you very much for your advice!

    BR

    Afshin

Maybe you are looking for

  • iPod Classic disconnect iTunes 12

    Finally managed to transfer content to iTunes from my old PC to my new iMac (yay!) - thanks for your help here However, after you have added a few new music (from CDs) tried to sync with my iPod (an old 160 GB classic). Once connected, iTunes I selec

  • How to set up and use two video cards at the same time.

    I have HP Pavilion a6150d desktop under Windows XP SP3 PC. My goal is to be able to use the integrated video card and GeForce 220 video card I just buy at the same time. The integrated video card and GeForce video card (connected to the PCI-E) are in

  • Installation of Vista updates: unknown error, code: 80200024

    Try to install 9 'important' updates, receive an error message, "Windows Update has encountered an unknown error." Error code is 80200024. Edit: Sorry, I clicked on 'Vista' as the version of windows, but it displayed in the Windows 7 forums.  Apologi

  • Find and replace the string function replaces line breaks when I only replaced spaces?

    I need to replace all instances of a space or a series of spaces to a line with commas (or tabs) multi string so I can throw in a worksheet. I use the regular expression [\s]+ and it works, but it is also to replace the end of lines (\r\n) too. How c

  • Error code 7c45158d-c250-443c-826f-4b63883a9272

    page host comuter is black with a garbage can and a mouse icon.  Error code 7c45158d-c250-443c-826f-4b63883a9272 says I have no disk space and it was 3/4 empty. nothing works