Aggregate XML columns in a single row in Oracle

Hello

I have a table named TMTABLE HT and it followed columns:

ID, NAME, TEXT
1 orders XML1
2 orders XML2
3 orders for XML3

where XML1, XML2 and XML3 follow:

XML1:

<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005146
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >

XML2:

<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005147
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >

XML3:

<? XML version = "1.0" encoding = "utf-8"? >
The <>rowsets
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005148
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >
< / sets of lines >

Now, I want to query Oracle get this XML1, XML2 and XML3 in a single row, in the following format:

<? XML version = "1.0" encoding = "utf-8"? >
rowset <>
< row >
< Uom IN. = "" > < DB > 4500005146
< Uom of line = "" > 10 < / Line >
< / row >
< row >
< Uom IN. = "" > < DB > 4500005147
< Uom of line = "" > 10 < / Line >
< / row >
< row >
< Uom IN. = "" > < DB > 4500005148
< Uom of line = "" > 10 < / Line >
< / row >
< / lines >

I tried various queries, but not able to do this. Can someone help me please how to do in this regard?

Hello

Assuming that TEXT column of XMLType data type:

SQL> select xmlelement("Rowset",
  2           xmlagg(x.column_value)
  3         ) as result
  4  from tmtable t
  5     , xmltable('/Rowsets/Rowset/Row' passing t.text) x
  6  ;

RESULT
--------------------------------------------------------------------------------

  4500005146
  10


  4500005147
  10


  4500005148
  10


 

Tags: Oracle Development

Similar Questions

  • concatenate the strings from a column into a single row?

    How to concatenate strings from a column into a single line?

    Color
    ------
    Red
    Orange
    Blue
    Green

    And return a set of results as follows:

    Colors
    -------------------------
    Red, orange, blue, green

    Various ways can be found here:
    http://www.Oracle-base.com/articles/10G/StringAggregationTechniques.php

  • SQL multiple columns in a single row

    Hi all

    I have 2 tables, product and Product_Name, a product can have several names.

    I need to recover what I show the Product_ID followed by all the names of this product has.

    I am not able to do, every way I try get the product ID duplicated several lines with a name of different product on each line as follows:

    ' 1, ' iron Z.
    1, "iron M.
    1, "iron N".
    2, 'wood P.
    2, 'wood M.

    What I need is:

    1, Z, M iron, iron N
    2, wood P, wood M

    Thank you and best regards.

    Hello

    user10103934 wrote:
    Thanks for the reply from Frank,

    Iron Z, iron and iron N M would be 3 different entries in the same column.

    I'm sure that the LISTAGG function should solve this problem, the problem is that I expected to find a solution on pure SQL or PL/SQL, perhaps with a nested Select statement.

    My version of Oracle's 10g Express Edition.

    LISTAGG is pure SQL, but it was introduced only in Oracle 11.2. All mentioned below should work in Oracle 10.

    The STRAGG from this page is very useful. You must copy and install approximately 60 line of PL/SQL code. Do it once, and then you can use hundreds of times in hundreds of motions, as if it were a built-in function. The main problem with STRAGG, it is difficult to get the output soprted. There is a modified version, designed for output sorted on this thread:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:15637744429336
    Never used. Can't vouch for it.

    SYS_CONNECT_BY_PATH seems to be the most popular way after the aggregation of the chain in Oracle 10. The example given on the page of the Oracle Base (that I posted in my last post) is a little clumsy and inefficient. See the next thread for a better example, using CONNECT_BY_ISLEAF:
    Re: Concatenate strings more lines in a single line.
    or, now that I see it, Pollywog example above.

    Published by: Frank Kulash, June 11, 2010 14:24

  • display of the values of column in a single row

    Hello

    Can you give me please workarounds for this problem:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    -- sample data
    CREATE TABLE TEST_DATA
    (
      CUSTOMERID   CHAR(2 BYTE),
      CITY         VARCHAR2(70 BYTE),
      ZIP          VARCHAR2(10 BYTE),
      CONTACTTYPE  VARCHAR2(30 BYTE)
    );
    Insert into TEST_DATA (CUSTOMERID, CITY, ZIP, CONTACTTYPE)
     Values ('23', '41', '3100', 'MAILING');
    Insert into TEST_DATA (CUSTOMERID, CITY, ZIP, CONTACTTYPE)
     Values ('23', '63', '4720', 'LEGAL');
    Insert into TEST_DATA (CUSTOMERID, CITY, ZIP, CONTACTTYPE)
     Values ('24', '44', '3200', 'MAILING');
    Insert into TEST_DATA (CUSTOMERID, CITY, ZIP, CONTACTTYPE)
     Values ('25', '36', '3500', 'MAILING');
    Insert into TEST_DATA (CUSTOMERID, CITY, ZIP, CONTACTTYPE)
     Values ('25', '39', '2800', 'LEGAL');
    COMMIT;
    
    select * from test_data;
    CUSTOMERID          CITY        ZIP     CONTACTTYPE
    23                    41       3100     MAILING
    23                    63       4720     LEGAL
    24                    44       3200     MAILING
    25                    36       3500     MAILING
    25                    39       2800     LEGAL
    Need a result like this:
    CUSTOMERID | MAILING_CITY | MAILING_ZIP | LEGAL_CITY | LEGAL_ZIP
    23                 41               3100          63        4720
    24                 44               3200          NULL     NULL
    25                 36               3500          39        2800
    Thank you very much
    Alex

    Try this...

    This works for me in Oracle 10 g.

    select customerid,
           MAX(DECODE(CONTACTTYPE,'MAILING',city,null)) MAILING_CITY,
           MAX(DECODE(CONTACTTYPE,'MAILING',zip,null)) MAILING_ZIP,
           MAX(DECODE(CONTACTTYPE,'LEGAL',city,null)) LEGAL_CITY,
           MAX(DECODE(CONTACTTYPE,'LEGAL',zip,null)) LEGAL_ZIP
    from test_data
    group by customerid
    

    Kind regards
    Rakesh

  • 10g TRANSPOSE a single ROW/columns in ROWS/columns

    Hello
    I have a query that returns a single row with 4 columns

    I need output in a single line by column

    Here is a table of test;
    CREATE TABLE TEST
    (
    SEQ VARCHAR2(10),
    FT DATE,
    CD DATE,
    DELTA NUMBER(10)
    );
    INSERT INTO TEST (SEQ, FT, CD, DELTA) VALUES ('1111',SYSDATE-1,SYSDATE,1);
    
    SET NUM 999;
    
    SELECT SEQ, FT, CD, DELTA FROM TEST;
    
    DROP TABLE TEST;
    the output current is;
    SEQ        FT                        CD                        DELTA                  
    ---------- ------------------------- ------------------------- ---------------------- 
    1111       09-AUG-10                 10-AUG-10                 1                      
    and want;
    SEQ       1111
    FT        09-AUG-10
    CD        10-AUG-10
    DELTA     1
    SQL> ed
    Wrote file afiedt.buf
    
      1   select regexp_substr(str,'[^,]+',1,level)
      2   from
      3   (
      4   SELECT SEQ||','|| FT||','||CD||','||DELTA  str FROM TEST25
      5   )
      6*  connect by level <= length(str) - length(replace(str,','))+1
    SQL> /
    
    REGEXP_SUBSTR(STR,'[^,]+',1,LEVEL)
    -----------------------------------------------------------------------
    1111
    09-AUG-10
    10-AUG-10
    1
    
  • value of multiple line in a single row (nclob)

    Hello
    I have a requirement where I have to work on a nclob data type column, now here the value of 2 lines in a single column. Like this:

    Select extractvalue (xmltype (details), '/ Anything/invoiceNumber') separate as invoices,
    actinguserid as user_id, createdt
    of bchistevent where bucket = 201301
    and upper (type) = ' COM. AVOLENT. PRESENTATION. EVENT. INVOICEDOWNLOADEVENT'
    - and bchistevent.bucket = to_char (add_months (sysdate-1), "YYYYMM")

    000-395452969-20130103 1.46388193452398E37 08/01/2013 03:05:42
    300000590-000-20090723 1.46388193452398E37 11/01/2013 08:11:45
    300000590-000-20090723 1.46388193452398E37 11/01/2013 08:12:50
    000-395453127-20130103 1.46388193452398E37 14/01/2013 04:44:26
    * 300084670-000-20120906, 300084671-000-20120906 * 1.46388193452398E37 07/01/2013 12:45:19 AM
    000-395452626-20130103 1.46388193452398E37 08/01/2013 03:03:57
    000-300084679-20120906-1.46388193452398E37 11/01/2013 08:10:47
    300000728-000-20090731 1.46388193452398E37 11/01/2013 08:19:19
    000-300084679-20120906 1.46388193452398E37 14/01/2013 12:31:48 AM
    300000590-000-20090723 1.46388193452398E37 14/01/2013 04:13:19
    000-395452718-20130103 1.46388193452398E37 08/01/2013 07:10:19
    000-300084679-20120906 1.46388193452398E37 23/01/2013 06:54:11
    000-300084679-20120906 1.46388193452398E37 22/01/2013 03:11:54
    300000590-000-20090723 1.46388193452398E37 11/01/2013 08:14:02
    000-395453127-20130103 1.46388193452398E37 14/01/2013 04:33:12
    000-300084679-20120906 1.46388193452398E37 22/01/2013 03:03:36
    000-300084679-20120906 1.46388193452398E37 14/01/2013 12:34:13 AM
    000-395452997-20130103 1.46388193452398E37 07/01/2013 03:31:38
    000-395452391-20121027 1.46388193452398E37 03/01/2013 04:40:05

    and the value of the "BOLD" highlighted line is coming in a single line, please help how to break this in 2 rows?

    Published by: user1175303 on March 13, 2013 05:43

    user1175303 wrote:
    the value of the column that is involved is 300084670-000-20120906, 300084671-000-20120906 here I get 2 values in a single column, and for this reason, I am unable to get the desired result.

    If you have XML question but try to solve in Oracle? Why is the owner of two invoice numbers? In any case:

    with t as (
               select  distinct extractvalue(xmltype(details),'/Anything/invoiceNumber') as invoices,
                       actinguserid as user_id,
                       createdt
                 from  bchistevent
                 where bucket = 201301
                   and upper(type) = 'COM.AVOLENT.PRESENTATION.EVENT.INVOICEDOWNLOADEVENT'
              )
    select  regexp_substr(invoices,'[^,]+',1,column_value) invoices,
            user_id,
            createdt
      from  t,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= length(regexp_replace(invoices,'[^,]')) + 1
                               )
                       as sys.OdciNumberList
                      )
                 )
    /
    

    SY.

  • Need for the sql query to have several columns in a single coulumn

    Hi all

    I need create the query to have several columns in a single column with several lines.

    Select a.customer_trx_id, a.previous_customer_trx_id
    of ra_customer_trx_all one
    where a.customer_trx_id =: customer_trx_id

    Here, a.customer_trx_id and a.previous_customer_trx_id are in two columns. I need to put them in a single column.

    Say: the foregoing is output
    --------------------------------------------------------------------------------
    a.customer_trx_id a.previous_customer_trx_id

    --------------------------------------------------------------------------------
    123456 87654

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

    Need for a single column

    As


    --------------------------------------------------------------------------------
    123456
    87654

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

    Please do the needful. Please note that it is not the UNION.

    Thank you
    Abdul

    Hello

    You want a way to confirm that what looks like two rows is really a line?

    Here are three ways:

    (1) count the lines:

    WITH  my_original_querry     AS
    (
         select  a.customer_trx_id || CHR(13)
                          || a.previous_customer_trx_id     as id
         from      ra_customer_trx_all     a
         where      a.customer_trx_id      = 274881
    )
    SELECT     COUNT (*)
    FROM     my_original_query;
    

    (2) in SQL * Plus, have SQL * more count them for you:

    SET     FEEDBACK     1
    
    select  a.customer_trx_id || CHR(13)
                     || a.previous_customer_trx_id     as id
    from      ra_customer_trx_all     a
    where      a.customer_trx_id      = 274881;
    

    (3) implicitly count them with the ROWNUM Pseudo-column

    select  a.customer_trx_id || CHR(13)
                     || a.previous_customer_trx_id     as id
    ,     ROWNUM
    from      ra_customer_trx_all     a
    where      a.customer_trx_id      = 274881;
    
  • Single - row subquery returns more than one line.

    Hi Experts

    I am faced with error

    ORA-01427: single - row subquery returns more than one line.

    MyQuery is:

    select
       TO_CHAR(T.MR_REG_DATE,'DD')                     "DATE"
       ,CASE  
         WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||'  - ('||'0 - 1 Month)'
         WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||'  - ('||'2 - 12 Months)'
         WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||'  - ('||'1 - 5 Years)'
         WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||'  - ('||'5 - 10 Years)'
         WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||'  - ('||'> 10 Years)'
        END age
      ,count(T.Mr_Code) No_of_Patient
      ,(  SELECT count(x.mr_code) mr_code
             FROM HMIS_MRINFO X
             where X.mr_reg_date between &FRM_DATE AND &TO_DATE
               and X.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y
                                      WHERE Y.mr_reg_date between &FRM_DATE AND &TO_DATE
                                    )
            GROUP BY CASE  
                       WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) between 0 and 1 THEN ' 01'||'  - ('||'0 - 1 Month)'
                       WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||'  - ('||'2 - 12 Months)'
                       WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||'  - ('||'1 - 5 Years)'
                       WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||'  - ('||'5 - 10 Years)'
                       WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) > 120 then ' 05'||'  - ('||'> 10 Years)'
                      END 
      ) Missing_MR
    from hmis_mrinfo T,hmis_pat_add_dis_detail M
    where T.mr_code = M.mr_code(+)
      and T.mr_reg_date between &FRM_DATE AND &TO_DATE
      &AGE_GRP
    GROUP BY T.MR_REG_DATE
             ,CASE  
               WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||'  - ('||'0 - 1 Month)'
               WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||'  - ('||'2 - 12 Months)'
               WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||'  - ('||'1 - 5 Years)'
               WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||'  - ('||'5 - 10 Years)'
               WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||'  - ('||'> 10 Years)'
              END 
    ORDER BY T.MR_REG_DATE;
    

    Please give some advice / solution.

    I think this might do it for you

    Select

    TO_CHAR (T.MR_REG_DATE, 'DD') "DATE."

    CASE

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'.  - ('||' 0-1 month)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'.  - ('||' 2-12 months)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'.  - ('||' 1-5 years)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'.  - ('||' 5-10 years)'

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'.  ' - ('| ' > 10 years).

    Age of the END

    count (T.Mr_Code) No_of_Patient

    , count (case when t.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y))

    WHERE Y.mr_reg_date between & FRM_DATE AND & TO_DATE)

    then t.mr_code

    (end) Missing_MR

    of hmis_mrinfo T, hmis_pat_add_dis_detail M

    where T.mr_code = M.mr_code (+)

    and between T.mr_reg_date & FRM_DATE AND & TO_DATE

    & AGE_GRP

    T.MR_REG_DATE GROUP

    CASE

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'.  - ('||' 0-1 month)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'.  - ('||' 2-12 months)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'.  - ('||' 1-5 years)"

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'.  - ('||' 5-10 years)'

    WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'.  ' - ('| ' > 10 years).

    END

    ORDER BY T.MR_REG_DATE;

  • Validate the XML column when inserting

    Hello

    I'm on 11 GR 2.

    I have a table

    create table root_table (id number, text xmltype);

    I tried to sign up:

    Start

    dbms_xmlschema.registerSchema ('test', xmltype)

    "' < xs: schema xmlns: XS ="http://www.w3.org/2001/XMLSchema"xmlns:xdb ="http://xmlns.oracle.com"elementFormDefault ="unqualified">

    < name XS: complexType 'RootType' = >

    < xs: SEQUENCE >

    < xs: element name = "Required" / >

    < xs: element name = "Énumération" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:enumeration value = 'A' / >

    < xs:enumeration value = 'B' / >

    < xs:enumeration value = 'C' / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MinLength" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:minLength value = "4" / >

    < xs:maxLength value = "20" / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MaxLength" >

    < xs:simpleType >

    < xs:restriction base = "XS: String" >

    < xs:minLength value = "1" / >

    < xs:maxLength value = "4" / >

    < / xs:restriction >

    < / xs:simpleType >

    < / xs: element >

    < xs: element name = "MaxOccurs" type = "xs: String" maxOccurs = "2" / >

    < xs: element name = "MinOccurs" minOccurs = '2' maxOccurs = "2" / >

    < xs: element name = "Optional" type = "xs: String" minOccurs = "0" / >

    < / xs: SEQUENCE >

    < / xs: complexType >

    < xs: element name = "root" type = "RootType" xdb:defaultTable = "ROOT_TABLE" / >

    ((< / xs: Schema > '));

    end;

    /

    table should point to the table where the XML column is default, I guess that

    is the 'root' in the same line a reference to the name of the xmltype column?

    Now - how do I ensure the XML I have insert in the column "change" is validated against the schema above?

    concerning

    Mette


    For both options, save the diagram with these options (you can substitute the url of course):

    Start

    () dbms_xmlschema.registerSchema

    schemaURL-online "test.xsd.

    schemaDoc-online xmltype (bfilename ('TEST_DIR', 'test.xsd'), 873)

    local-online true

    genTypes-online fake

    genTables-online fake

    enableHierarchy-online dbms_xmlschema. ENABLE_HIERARCHY_NONE

    options-online dbms_xmlschema. REGISTER_BINARYXML

    );

    end;

    /

    Then the #1 option:

    create table root_table)

    Identification number

    text xmltype

    )

    XMLType column can store as xml binary securefile

    XmlSchema 'test.xsd' element 'root '.

    ;

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 12345

    8

    9

    10

    11  ')

    (12);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

    ORA-19202: an error has occurred in the processing of XML

    LSX-00222: "12345" is too long (maximum is 4)

    SQL >

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 1234

    8

    9

    10

    11 ')

    (12);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

    ORA-19202: an error has occurred in the processing of XML

    LSX-00213: only 1 occurrences of the 'MinOccurs' particle, the minimum is 2

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    D

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    insert into root_table values (1,

    *

    ERROR on line 1:

    ORA-31061: error XDB: XML error event

    ORA-19202: an error has occurred in the processing of XML

    LSX-00290: invalid enumeration choice "D".

    SQL > insert into root_table values (1,

    2 xmlparse (document

    3'

    4

    5    A

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    1 line of creation.

    For the #2 option:

    create table root_table2)

    Identification number

    text xmltype

    )

    XMLType column can store it as clob securefile

    ;

    create or replace trigger root_table2_biu_t

    before the insert or update

    on root_table2

    for each line

    declare

    doc xmltype: =: new.tekst.createSchemaBasedXML ('test.xsd');

    Start

    doc.schemaValidate ();

    end;

    /

    SQL > insert into root_table2 values (1,

    2 xmlparse (document

    3'

    4

    5    D

    6 XXXX

    7 1234

    8

    9

    10

    11

    12  ')

    (13);

    insert into root_table2 values (1,

    *

    ERROR on line 1:

    ORA-31154: invalid XML document

    ORA-19202: an error has occurred in the processing of XML

    LSX-00290: invalid enumeration choice "D".

    ORA-06512: at "SYS." XMLTYPE", line 354

    ORA-06512: at DEV. "" ROOT_TABLE2_BIU_T ", line 4

    ORA-04088: error during execution of trigger ' DEV. ROOT_TABLE2_BIU_T'

    Both options will perform a validation of strict type.

    There are other possible configurations, such as CLOB based on a storage schema, but this approach is now obsolete.

    If you are only interested in whether the XML instance is valid or not, you can also use a constraint check with the XMLisValid function.

  • Hide the results of the column in the total row large pivot

    Hello

    Do you know if it is possible to hide the result of a particular column in a total row large pivot?
    I have several columns that makes sense to use a total of lines (as in money), but others (like average) is not logical in view of the customer to business rules.

    Any help on this is much appreciated :)

    Thanks in advance,
    J marks

    Have you tried to move this column of lines measure?

  • role of the listener.ora in a single installation of Oracle client?

    What is the role of listener.ora in a single installation of Oracle client? In scenarios that I can use?
    Thank you
    Smith

    Listener.ora is not used on the client

  • Transpose a single row of (definition, value) pairs in 2 columns

    I need to convert or turn a result monkey of a row in a table 2 (alias) manual column headers.

    Table

    ID Description Option1 Desc value of option 1 Option 2 Desc value of option 2 Option3 Desc value of option3 Option4 Desc Option4 value
    1Seller - Lang - MenutypeSeller - Lang - Opt1Value1Seller - Lang - Opt2Value2Seller - Lang - Opt3Value3Seller - Lang - Opt4Value4

    My current table has 8 options in total, but this should be enough.

    My select statement can make me what I want if poster horizontally that I missing just the knowledge necessary to transpose.

    Menu option Value Menu option Value Menu option Value Menu option Value
    Seller - Lang - Opt1Value1Seller - Lang - Opt2Value2Seller - Lang - Opt3Value3Seller - Lang - Opt4Value4

    I have to post this and I really need a query.

    Menu option Value
    Seller - Lang - Opt1Value1
    Seller - Lang - Opt2Value2
    Seller - Lang - Opt3Value3
    Seller - Lang - Opt4Value4

    Hello

    It's called Unpivoting, and here's a way to do it:

    SELECT menu_option, value

    FROM table_x

    UNPIVOT (menu_option, value)

    COLLAR IN ((option1_desc, option1_value))

    (option2_desc, option2_value)

    (option3_desc, option3_value)

    (option4_desc, option4_value)

    )

    ;

    If you would care to CREATE States TABLE and INSERT post for your sample data, then I could test it.

  • Column not null in rows in SQL query

    I have the below query,

    WITH t

    Did YOU (SELECT NULL col_1, col_2, 'C' FROM DUAL col_3 NULL

    UNION ALL

    SELECT 'A' col_1, col_2 NULL, NULL FROM DUAL col_3

    UNION ALL

    NULL SELECT col_1, col_2 "B", NULL FROM DUAL col_3)

    SELECT *.

    T;

    who will pick up three rows, on which single column will have a value for each row.
    And the other columns are left out as below.

    COL_1 COL_2 COL_3
    C
    A
    B

    I don't need that values should be extracted in the column name that is not null.

    as

    COL_1 COL_2 COL_3
    ABC


    Please advise me

    You can use the MAX aggregate function. But do not know what you are trying to reach.

  • Single line based on two columns and a single column

    Dear members,

    I have a table that contains duplicate rows, for which a request should be able to extract the unique row in the table. Here the unique is not based on a single column, but it should be in two columns and also check on the uniqueness on a column.

    create table addr (varchar2 (10) firstname, lastname varchar2 (10), area varchar2 (3));

    insert into values addr ('bob', 'james', 1');
    insert into values addr ('bob', 'james', 1');

    insert into values addr ('harry', 'bert', ' 1');
    insert into values addr ('jimmy', 'bert', ' 1');

    insert into values addr ('sam', 'mac', '1');
    insert into values addr ('sam', 'Knight', '1');

    insert into values addr ('tom', 'sand', '1');
    insert into values addr ("cat", "mud", "1");


    The query output must contain 3 lines.

    Bob - james
    Harry - bert or jimmy - bert [or the other of them], but not both
    -Mac or sam - Sam Knight [or the other of them], but not both
    Tom - sand
    Cat - mud

    SELECT firstname, lastname as total area WHERE addr = '1' GROUP by firstname, lastname; It takes no duplication of single column...

    Any suggestions...
    SQL> with t_data
    as
    (
    select 'bob' as firstname, 'james' as lastname, '1' as area from dual union all
    select 'bob', 'james', '1' from dual union all
    select 'harry', 'bert', '1' from dual union all
    select 'jimmy', 'bert', '1' from dual union all
    select 'sam', 'mac', '1' from dual union all
    select 'sam', 'knight', '1' from dual union all
    select 'tom', 'sand', '1' from dual union all
    select 'cat', 'mud', '1' from dual
    )
    SELECT
            firstname,
            lastname,
            area
    FROM
            (
                    SELECT
                            t.*,
                            row_number() over(partition BY firstname order by 1) rn,
                            row_number() over(partition BY lastname order by 1) rn1
                    FROM
                            t_data t
            )
    WHERE
            rn     = 1
    AND rn1 =1 ;  
    
    FIRSTNAME       LASTNAME        AREA
    --------------- --------------- ----------
    bob             james           1
    cat             mud             1
    jimmy           bert            1
    sam             knight          1
    tom             sand            1
    
    SQL>
    
  • Merge multiple columns into a single column?

    Hello

    I need to perform queries dynamically and the return values. I need to retrieve the values of the queries in a single column only by concatenating multiple columns. I can't use the PL/SQL in my scenario.
    is it possible to run a query and the result will be extracted in a single column (multiple column values must be concatenated)?

    Thank you
    Raja.
    SELECT rtrim(extract(xmltype(REPLACE(column_value,'
    

    Check this box... Copy it directly to this

    Ravi Kumar

Maybe you are looking for

  • XW4400 workstation: decommissioning of BIOS

    Just updated the BIOS to V02.07 (later) and now the CPU fan will NOT leave until a quiet speed.  It was NOT like this before the upgrade and can not now seen to locate the BIOS version v01.03 which was originally it (no, I don't have a copy until I u

  • Cannot open exe. files without pop up asking what program to use to open the file

    My PC has been infected! I have Windows XP. When I try to open any exe. file, I get a pop-up window asking me what program to open the file with. Any suggestions on how to fix this problem myself?

  • price of the battery

    What will be the price of dv5-1002 at pavilion entertainment PC

  • How to get special characters in the oracle column only

    Hi allwith spec_tabas(Select ',' col1 of doubleUnionSelect ',' col1 of doubleUnionSelect 'something' double)Select col1of spec_tabHow to get special characters in the oracle column only

  • Problems to use effects in photoshop?

    Whenever I find an effect (i.e., the effect of the Sun) online, I don't know how to put it in photoshop because of the darkness that surrounds instead of transparency.Example of the effect:Is there a specific path or a folder, you must put this in so