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>

Tags: Database

Similar Questions

  • Good way to eliminate a display with the children &amp; listeners object

    It is my function that creates a display object with several children, one is an event listener.

    function makeIt (): void {}

    var spriteA:Sprite = new Sprite();

    var spriteB:Sprite = new Sprite();

    spriteB.addEventListener (MouseEvent.CLICK, myCallback);

    var spriteC:Sprite = new Sprite();

    spriteA.addChild (spriteB);

    spriteB.addChild (spriteC);

    stage.addChild (spriteA);

    }

    Let's say that I'm done with it. What is the right way to dispose of it so that it uses more memory? I do all this?

    spriteB.removeChild (spriteC);

    spriteB.removeEventListener (MouseEvent.CLICK, myCallback);

    spriteA.removeChild (spriteB);

    stage.removeChild (spriteA);

    I read that some people say that you must also assign things to null, then maybe like this? :

    spriteB.removeChild (spriteC);

    spriteC = null;

    spriteB.removeEventListener (MouseEvent.CLICK, myCallback);

    spriteA.removeChild (spriteB);

    spriteB = null;

    stage.removeChild (spriteA);

    spriteA = null;

    And I have a few questions:

    1. what happens if I just removeChild (spriteA) when I'm done with him and call makeIt() later when I need it? Are the same variables being reassigned, so there is no need to clean up after them?

    2. If this display object will be frequently used and removed, would it be better to simply turn spriteA.visible?

    Also, I am familiar with the weak event listeners, but I prefer not to use them.

    removeChild is not deleting anything, whether it is simply detached from the display list... it could very well known as setting the visible property of the object to be both Visual false... the object is still there and can be targeted with the code in both cases.  If you want things get out and be ready for garbage collection, you must remove all references to them and objects Dummies.  If you know that an object is often reused so you probably want to go the road visible from true/false, although using addChild/removeChild can work as well.

  • 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 ;

  • 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

  • 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: 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> 
    
  • 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
     
    
  • Unable to create cache with several tables group

    Hello

    I need to create a group of cache with several tables, which are referential to the other.

    There are 2 related tables and table 1 child...
    While trying this thing, it gives me an error:

    8222: multiple parent tables found

    It is not possible to use several tables of root in a single cache group? Is there another way to use it?

    Script, I used is:

    create a cache group asynchronous writethrough TEST. CG1
    of the TEST. ROOT1)
    KEY PRIMARY ID VARCHAR2 (8 BYTES),
    NAME VARCHAR2 (50 BYTE),
    DESCRIPTION VARCHAR2 (255 BYTE),
    POLICYTYPEID VARCHAR2 (7-BYTE)),

    TEST. ROOT2)
    PARAMTYPEID VARCHAR2 (5 BYTES) PRIMARY KEY,
    PARAMETERUSAGE VARCHAR2 (1 BYTE),
    NAME VARCHAR2 (25 BYTE),
    DESCRIPTION VARCHAR2 (255 BYTE)),

    TEST. CHILD1)
    PARAMDETAILID NUMBER (20) PRIMARY KEY,.
    ID VARCHAR2 (8 BYTE),
    PARAMETERUSAGE VARCHAR2 (1 BYTE),
    DISPLAYVALUE VARCHAR2 (255 BYTE),
    OPERATORID VARCHAR2 (5 BYTE),
    VENDORID NUMBER (20).
    FOREIGN KEY REFERENCES TEST. ROOT1 (ID),
    TEST KEY (PARAMETERUSAGE) REFERENCES STRANGERS. ROOT2 (PARAMETERUSAGE));

    You can't have multiple root within a group of cache tables. The requirements for tables in the group a cache are very strict; There must be only one top-level (root table) table and there may possibly be several children tables. Tables of the child should be linked through foreign keys to the root table or a child table above in the hierarchy.

    The solution for your case is among the tables of root and the other root table in a separate cache group and the child table in a cache group. If you do this, you must take care of a few things:

    1. you cannot define foreign keys between the tables of groups of different cache in TimesTen (keys may exist in Oracle) so the application must enforce referential integrity itself for these cases.

    2. If you load data in a cache group (using LOAD the GROUP CACHE or "load we demand") and Timesten will not automatically load the corresponding data in the other group of cache (since he doesn't know the relationship). The application must load the data into the other group of cache explicitly.

    There is no problem with transactional consistency when changes are pushed to Oracle. TimesTen maintains and reinforces the coherence transactional regardless of how the tables are arranged in groups cache correctly.

    Chris

  • Shortcut for the new window with several tabs

    Is it possible to have a shortcut on the desktop to launch a new window with several tabs? For example - home page is set to "www.google.com", but the shortcut opens new window with tabs "www.cnn.com" and "www.youtube.com".

    Then far,.../firefox.exe-nouveau-fenetre followed by the two URL in quotes will open two new windows. Entry - new-window "www.cnn.com" - new-tab 'www.youtube.com' will open two new windows if no instance of firefox is open, but if another window is already open, youtube will add a tab to the already open window, rather than the new window with cnn.com

    In reply to myself... withdrawal-order new window (and-new-tab), now it works.

    Looks like I'm too complicated it.

    shortened final was "C:\Program Files (x 86) \Mozilla ' 'url1'"url2.

  • Functions defined by the user with several parameters

    I set features three following user using "Define."

    UF1 takes a single patameter;

    UF2 takes two parameters;

    and UFX takes two parameters - with the second is 'X' in the definition.

    Œuvres F1.  F2 is the EVAL of F1 version and it works too.  User functions only seem to work fine.

    F3, a function of two user settings, produces a graph of NaN.

    F4 is the EVAL of F3 version.  Note that 'B 'is not replaced by 1'.  Also produces a NaN chart.

    F5 produces a graph of NaN.

    F6 is EVAL of F5.  The 'X' is not replaced (even with the ' B' above), and even if it looks like 'X * X', it also produces a graph of NaN.

    Is it possible to get defined by the user, with several parameters, features work by tracing the curve?

    Hi!, Fortin:

    If you download and install the ultimate Firmware with the version of the software: 2015 6 17 (8151), with the number of Version: 1.1.2 - 11, you can trace your examples of definition of the function, with curves and values, without NaN.

  • Background with several pictures

    How can I create a wallpaper for my iPad, iPhone, MacBook Air with multiple photos?

    (El Capitan, iOS 9.2.1 Photos)

    To create a collage of photos, you can create a photo book project and select a template page with several photos. Fill it with photos of your choice and print the page in PDF format.

    The themes of the book are different according to the terms of the photos and the number of photos per page.

    It's the theme travel plans:

    If you have installed iWork apps try Keynote to create a slide with many photos, arranged freely.

  • WiFi HP ENVY 4500 with several Access Points - same SSIS Configuration

    Hello

    We just got a HP ENVY 4500.  I have a main homenetwork with a wifi Modem/Router and an old router acting as an Access Point to the floor to extend coverage.

    Both have the same SSID and password and are set to different channels.

    My HP ENVY 4500 fails to connect when the Access Point is lit.

    It will connect with it.

    Once connected, I can turn on the PA and all is well.

    The two router an AP using WPA-PSK/WPA2-PSK encriptación

    The router (that it connects to) should have a better sgnal when both are on, so I do not understand why they need the AP to be turned off to connect.

    Any thoughts people?

    Eserim

    I think he has always had problems with several access points.  Try this, what ever AP is closest to the printer, set it to channel 1.  Then try channel 11.  Try now.

  • Carpet * a DVD-Ram UJ - 841S comes with several error messages

    My laptop is relatively new, I've been burning some video files in DVD - RW and all of a sudden my DVD drive has stopped working. It came with several error messages format "failed due to damage media", "format failed due to general failure" and "the inserted disc is READ only".

    I also can't rip music discs.

    Can you see ODD listed in Device Manager, and if so what is the exact status it?

    Sorry, but we discus on ODD, but nobody knows what model of laptop you have and what is the history of this problem. Is replaced the drive? Why are you sure that you are using compatible with your laptop ODD.

    Please more information!

  • Interfacing with several unknown USB devices; all producing NMEA strings

    Hi all

    Question about the peripheral USB interface and their associated drivers.

    I have the obligation to build an application that interacts with the USB devices that produce NMEA strings. I have the library to parse NMEA strings, but I fight with interfacing with several unknown USB devices. When deploying applications, I know not all possible USB devices to use.

    Is it possible to produce one driver who will accept any USB device strings?

    Or, more likely, is there a way to get the LV to recognize a connected USB device and automatically find / install the driver like windows does and is it possible to do in a deployed application?

    I had a trawl of the forums, but I've not found anything that specific.

    Thanks, I really appreciate the help.

    About the VI "set up the serial port", my problem is that the choice of COM port is in a separate menu (not directly related to the VI) and it allows all possible COM ports to be selected. That can be addressed.

    I am not expecting an all-in-one solution but asked the question in case it was possible.

    What I realized, is that for my specific condition to read strings from a USB device. It is likely to be sent over a serial connection. LV can handle this well and easily assuming the device has the installed driver / settings are available.

    LV (and indeed any other program) will not work without a device driver / settings. In this case, parameters set must be found (error) / a USB RAW driver would need to be developed. Devices requirng a RAW USB driver would need a serious review to continue due to the time and effort required. All this effort is work inherited from the AIDS to navigation

    I appreciate any help and I think I got the answer I was looking for! Thank you very much

Maybe you are looking for