string aggregation > 4000 store in varchar2 (4000)

Dear experts,

I'm using Oracle 11.2.0.3. I have the table such as

ID NAME

1 xyz

1 abc xyz

1 xyz abc def

2 abc

2 xyz nmnx

I want to aggregate them so that I have the aggregation of the NAME by ID

as

1XYZ xyz abc xyz abc def
2ABC xyz nmnx

I was able to do this using:

WITH t
     AS (SELECT 1 AS id, 'xyz' AS name FROM DUAL
         UNION ALL
         SELECT 1, ' xyz abc' FROM DUAL
         UNION ALL
         SELECT 1, 'xyz abc  def' FROM DUAL
         UNION ALL
         SELECT 2, 'abc' FROM DUAL
         UNION ALL
         SELECT 2, 'xyz  nmnx' FROM DUAL)
SELECT     id, RTRIM (XMLCAST (XMLAGG (XMLELEMENT (e, name, ' ') ORDER BY NULL) AS CLOB)) as agg_name
    FROM   t
GROUP BY   id;

However, if the length (agg_name) > 8 (for simplicity), then the name should be on a separate line with the same id

1 xyz xyz

1 abc def

1 xyz ABC

2 abc xyz

2 nmnx

token order is not important.

Thanks for any help

Above could be done using

WITH t
     AS (SELECT 1 AS id, 'xyz' AS name FROM DUAL
         UNION ALL
         SELECT 1, ' xyz abc' FROM DUAL
         UNION ALL
         SELECT 1, 'xyz abc  def' FROM DUAL
         UNION ALL
         SELECT 2, 'abc' FROM DUAL
         UNION ALL
         SELECT 2, 'xyz  nmnx' FROM DUAL)
SELECT     ID, LISTAGG (name) WITHIN GROUP (ORDER BY NULL) org_name
    FROM   (SELECT   ID,
                     name || ' ' name,
                     CEIL (SUM (len) OVER (PARTITION BY ID ORDER BY len) / 8) part,
                     len
              FROM   (SELECT    /*distinct */  ID, x.name, LENGTH (x.name || ' ') len
                         FROM   t, XMLTABLE ('ora:tokenize(.," ")' PASSING ' ' || TRIM (name) COLUMNS name VARCHAR2 (4000) PATH '.') x
                        WHERE   x.name IS NOT NULL))
GROUP BY   ID, part;

Tags: Database

Similar Questions

  • string aggregation 4000 +.

    Hi all

    I'm using Oracle 11.2.0.3.   I used LISTAGG to generate CSV values for names, but some of my values are greater than 4000 characters, it is throwing ORA-01489: result of concatenating string is too long.

    I tried to XMLAGG allowing to solve. However, this special character space.  (e.g. & be escaped to & the equivalent of xml security)

    for example

    with t as

    (SELECT ' has "PEOPLE ' as double fname)

    Union of all the

    SELECT ' BALL &' as double fname

    Union of all the

    Select "cat!"  as double fname)

    Select rtrim (xmlagg (xmlelement (e, fname,',').extract('//text () ') order of fname).) GetClobVal(), ',') AS NAME of t

    RETURNS: Has ' PEOPLE, BALL, & CAT!

    Has ' PEOPLE EXPECTED, BALL & CAT!

    Is it possible to disable escape everything using XMLAGG?

    Is there any other method recommended to use aggregation of chain for more than 4000 characters?

    Thank you very much!

    The following would be the correct way to do it in your version.

    Unescaping/cast the result as a CLOB will be XMLCast:

    with t as)

    Select ' has "PEOPLE ' as fname Union double all the

    Select ' BALL &' as fname Union double all the

    Select "cat!"  as double fname

    )

    Select rtrim)

    (xmlcast)

    XMLAGG)

    XmlElement (e, fname |) ',')

    order of the fname

    )

    as clob

    )

    , ','

    ) as name

    t;

    (in versions< 11.1,="" i="" would="" have="" used="" dbms_xmlgen.convert="" instead="" in="" order="" to="" unescape="" entity="">

  • Query (connect / string aggregation)

    Hello
    Can someone give me an example of a query


    VAL ID
    --------
    2B
    1 B
    1 C


    Output: "A, B, C".

    Thank you.

    Published by: Bolev on February 3, 2010 17:10

    Hello

    Pivot generates separate columns for each val, and you should know how much they will be.

    String aggregation provides a single column and does not need to know how many vals there will be:

    WITH     got_rnum     AS
    (
         SELECT     id
         ,     val
         ,     ROW_NUMBER () OVER ( PARTITION BY  id
                                   ORDER BY          val
                           ) AS rnum
         FROM    table_x
    )
    SELECT     id
    ,     LTRIM ( SYS_CONNECT_BY_PATH (val, ',')
               , ','
               )     AS val_list
    FROM     got_rnum
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     rnum     = 1
    CONNECT BY     rnum     = PRIOR rnum + 1
         AND     id     = PRIOR id
    ;
    
  • Reg: String aggregation-

    Hi Experts,

    I have a scenario where my query returns 4 ranks as
    A
    B
    C
    D
    -Results: ' a ',' B', 'C', d '.

    How can I achieve this using the aggregation of String?

    I'm working on-
    SELECT CHR (39)||RTRIM(XMLAGG (XMLELEMENT (e, <table_column>||''',''')).EXTRACT ('//text()'),''',''')|| CHR (39)
      FROM <my_table>;
    but give...
    'QFND340B&apos;,&apos;QFND434&apos;,&apos;'
    Database details - 
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE     10.2.0.3.0     Production
    TNS for Solaris: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production

    Try like this:

    select WM_CONCAT(''''||lvl||'''') from (
                              SELECT 'A' AS lvl FROM DUAL union all
                              SELECT 'B' AS lvl FROM DUAL union all
                              SELECT 'C' AS lvl FROM DUAL union all
                              SELECT 'D' AS lvl FROM DUAL
                              ) xx;
    
  • A string in an array of path strings

    Hello

    I want to read in a bunch of paths in the form of a long string such as:

    C:\Files1; C:\Files2; C:\Files3...

    such that when I get it in labview, he will separate this string to the (, store it in an array of strings, and then let me spend some time loop.) What vi can best accomplish this?

    Thank you

    Or simply use the string of worksheet to the array function.

  • Parse the JSON using PL/SQL string

    I created a script that reads data from the Mobile App DB (which is based on MongoDB) of Oracle SQL Developer. The result is the string JSON stored in l_response_text VARCHAR2 (32767);

    The string has the format such as:


    [{"Postcode":"47100","OutletCode":"128039251","MobileNumber":"0123071303","_createdAt":"2014-11-10 06:12:49.837","_updatedAt":"2014-11-10 06:12:49.837"}, {"Postcode":"32100","OutletCode":"118034251", ..... ]
    
    
    
    
    

    However, I need to analyze this l_response_text such that each table will in his column in a table called appery_test. appery_test table has the same number of columns pairs JSON and in the same order (e.g. name of the first column is 'postal Code')

    I searched and I found most of the results on the analysis of the Oracle in JSON table and not the other way around. I found, however, that link which is somewhat similar to my problem. However, the library suggested in the answer doesn't have an example on how to use it to insert JSON into conventional table using PL/SQL.

    N.B.: I use g 11 and not 12 c. If the functions built by are not available for me.

    Thank you very much

    Sorry, I am a novice in this area too.

    However, it worked for me:

    declare

    l_list json_list;

    l_data CLOB;

    Code postal clob;

    l_val json_value;

    Start

    -json data recovery

    Select the data in l_data from jsons where id = 1;

    l_list: = json_list (l_data);

    I'm looping 1.l_list.count

    l_val: = json_ext.get_json_value (json (l_list.get (i)), 'Postcode');

    DBMS_LOB.CREATETEMPORARY (zip, true, 2);

    json_value.get_string (l_val, postal code);

    -Put some things

    dbms_output.put_line (DBMS_LOB. GetLength (Postcode));

    dbms_output.put_line (dbms_lob.substr (postal code, 20, 1));

    DBMS_LOB.freeTemporary (Postcode);

    end loop;

    end;

    47328

    9J / / 4AAQSkZJRgABAQAA

    Added dbms_lob.freetemporary (postcode);

  • How to put a CustomField on a data store?

    Hi all

    I tried:

    Get-myDS data store | game-customfield-myName-name-value myValue

    but no luck.

    I also note:

    $myDS = get-myDS data store

    $myDS.extensiondata

    There is a field called:

    "CustomValue.

    How to fill this extensiondata. CustomValue field?

    Even if I can't put a customfield via whole-customfield, is there a solution or a hack to store a value for a data store?

    concerning

    marc0

    I'm afraid that the New-CustomField and New-CustomAttribute in the current construction of PowerCLI don't support data warehouses.

    But you can use the CustomFieldManager to manage the fields custom data warehouses.

    First get the CustomFieldManager object.

    $cfMgr = get-view customfieldsmanager

    To create a new field, you can make

    $cfMgr.AddCustomFieldDef ("Test", "Datastore", $null, $null)

    This method returns the CustomField object. It is important to store this somewhere, because you will need the Key property in the following methods.

    You can also get this key by enumerating the fields available for any data store

    PS C:\ > $ds = Get - Datastore - name MyDS

    PS C:\ > $ds. ExtensionData.AvailableField

    Key: 591
    Name: Test
    Type: string
    ManagedObjectType: data store
    FieldDefPrivileges:
    FieldInstancePrivileges:
    DynamicType:

    To assign a value to the new field

    $cfMgr.SetField($ds.) Extensiondata.MoRef, 591, "A value") "

    To retrieve the value of the custom field

    $ds. ExtensionData.CustomValue | where {$_.} Key - eq 591}

    DynamicType DynamicProperty key value
    -----                                          --- -----------              ---------------
    A value                                        591

    Note that these custom fields of the data store are not visible in the vSphere client!

  • Convert String performed far and format her

    Hello

    I am new to Adobe and javascript. I have a string value that stores the Date of birth in yyyy-mm-dd format, as a string. I need to convert this Date and then place it on a PDF field in the format mm/dd/yyyy.

    Can anyone help?

    Thank you

    You can convert a string representing a date in a date object using the util.scand JavaScript method and and then format a date to a string object by using the util.printd method. For more information, see:

    http://livedocs.Adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html

    http://livedocs.Adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html

    In your case, the code would be something like:

    sDate var = '2013-01-10;

    Convert string to date

    Kai var = util.scand ("yyyy-mm-dd", sDate);

    Convert date to a new string

    var sDate2 = util.printd ("mm/dd/yyyy", anyway);

    Set a field value

    getField("date2").value = sDate2;

    The exact code you use depends on where you place the script and where you get the original date string, but this should help you get started.

  • Display a String Array in a box

    Hi all

    I'm developing a web application using jd 11.1.1.4

    In my grain of support, I have a variable of String (String []) array to store messages.
    I want to display these messages in a web page by using a dialog box
    I want to know how to display a String [] in a dialog box

    Thanx

    instead of an array of strings... use an ArrayList... and display... the message of dialogue by using the af:forEach

  • Parse qualified double quote delimited strings

    Hi all

    I have a few strings of data that I get I want to analyze. My problem is that I am not able to understand how I can analyze the fields that are double quote qualified ("19 999")?

    I played with the regex_substr, but I can't quite make what I want.

    I want to analyze the myString column in my example below in four areas:
    Product
    OnOrder
    OnHand
    TotalSold

    Here is an example... I've been playing with it for a bit, and I can't get it.
    WITH parseString AS (Select 
                            '"Grado, Headphones",123,2222,"19,999" ' myString
                         from dual
                         UNION ALL
                         Select 
                            'Audio Slave,222,3333,444' myString
                         from dual
                         
                                    )
    Select 
        myString
    from parseString
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0 - 64bi
    PL/SQL version 10.2.0.3.0 - Production
    CORE Production 10.2.0.3.0
    AMT for Linux: release 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production


    Any suggestions greatly appreciated.

    S

    Published by: ScarpacciOne on April 22, 2010 15:24

    Hello

    As Centinul said, it would help a lot if you have published your desired results and explains how get you from the sample data.
    Here's something that can help, according to your specific needs:

    WITH     got_item_cnt     AS
    (
         SELECT     myString
         ,     1 + LENGTH (myString)
                - LENGTH (REPLACE (myString, ','))     AS item_cnt
         FROM     parsestring
    )
    ,     cntr     AS
    (
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= ( SELECT  MAX (item_cnt)
                           FROM    got_item_cnt
                         )
    )
    ,     comma_separated_values     AS
    (
         SELECT     i.myString
         ,     c.n
         ,     REGEXP_SUBSTR ( i.myString
                         , '[^,]+'
                         , 1
                         , c.n
                         )          AS value
         FROM     got_item_cnt     i
         JOIN     cntr          c     ON     c.n     <= i.item_cnt
    )
    ,     got_quote_cnt     AS
    (
         SELECT     myString
         ,     n
         ,     REPLACE (value, '"')     AS value
         ,     NVL ( SUM ( LENGTH (value)
                     - LENGTH (REPLACE (value, '"'))
                     ) OVER ( PARTITION BY  myString
                           ORDER BY      n
                           ROWS BETWEEN  UNBOUNDED PRECEDING
                             AND      1        PRECEDING
                            )
                  , 0
                  )          AS quote_cnt
         FROM     comma_separated_values
    )
    SELECT     myString
    ,     n
    ,     LTRIM ( SYS_CONNECT_BY_PATH (value, ',')
               , ','
               )          AS token
    FROM     got_quote_cnt
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     MOD (quote_cnt, 2)     = 0
    CONNECT BY     MOD (quote_cnt, 2)     = 1
         AND     myString     = PRIOR myString
         AND     n          = PRIOR n + 1
    ORDER BY     myString,     n
    ;
    

    Output of your sample data:

    MYSTRING                                N TOKEN
    -------------------------------------- -- --------------------
    "Grado, Headphones",123,2222,"19,999"   2 Grado, Headphones
    "Grado, Headphones",123,2222,"19,999"   3 123
    "Grado, Headphones",123,2222,"19,999"   4 2222
    "Grado, Headphones",123,2222,"19,999"   6 19,999
    Audio Slave,222,3333,444                1 Audio Slave
    Audio Slave,222,3333,444                2 222
    Audio Slave,222,3333,444                3 3333
    Audio Slave,222,3333,444                4 444
    

    The basic strategy is to divide myString to all the commas, then re - unite consecutive elements that are in double - quotes.
    You never said what version of Oracle are you uisng.
    This solution works in Oracle 10.1. REGEXP_COUNT, introduced in Oracle 11.1, would make it a bit simpler.

    Here is each subquery:
    got_item_count finds the number of elements by commas in each myString
    CNTR generates integers 1, 2, 3,... until the maximum number of elements by commas on line any
    comma_separated_values myString splits its different elements, ignoring the quotes at the moment. I assumed myString is unique. If this isn't the case, you need some other unique identifier for each row of parsestring.
    * quote_cnt had "notes how quotes took place in myString, each element not included.  If (and only if) this number is odd, then the element is really a continuation of a previous item, in other words, the comma that separates this point from the previous one was within quotation marks and therefore should not have divided myString.  I assumed that the double-quote character always indicates the grouping; It is never to be taken literally, and therefore the final results will never contain quotes.
    The main query string aggregation on consecutive points, bringing together all the elements that are weird quote_cnts with the last item previous had a same quote_cnt.

    Published by: Frank Kulash, 22 April 2010 23:33

  • How to convert the string to the variable of the apex

    Hello

    I need to replace the overall point of the table column value chain in its value of origin when the page is rendered.

    the process code - plsql
    -column replacestring contain the string F100_EMPID value
    declare
    REP varchar2 (100);
    Start
    Select replacestring in the rep of emp;
    Select Replace ('EmployeeID', replacestring) in the content of emp;
    HTP.p (content);
    end;

    The output is:
    The employee ID is: F100_EMPID.

    but I need the actual value of the global element when the process is rendered.

    Select Replace (content, "EmployeeID",: F100_EMPID) in the content of emp;

    This statement gives a correct output: Employee id is: 230092

    I need to replace the string in the column of the table in the real global element inside the plsqcode for dynamic rendering code.

    someone please help me solve this problem.

    Thank you.
    ~ Logaa

    Hello

    What happens if you use:

    Select Replace (happy, 'EmployeeID', v (replacestring)) in the content of emp;
    or maybe
    Select Replace (content, "EmployeeID", v ("| replaceString |")) in the content of emp;

    Greetings,
    Roel

    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.Logica.com/

    You can assign this answer to your question in marking it as useful or Correct ;-)

  • Remove duplicates of LISTAGG

    Oracle 11 g 2 Server

    You need to remove from a call LISTAGG dups.

    create table ptpos_explanations (
        id    number ,
        fr_id number ,
        part_type_id   number ,
        position_id    number ,
        ptpos_list     varchar2(4000)
    );
    
    insert into ptpos_explanations
    values(182527,100, 10,1,'It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100');
    
    
    insert into ptpos_explanations
    values(182527,100, 10,2,'It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100');
    
    
    insert into ptpos_explanations
    values(182527,110, 20,1,'It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100');
    
    insert into ptpos_explanations
    values(182527,110, 20,2,'It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100');
    
    commit;
    
    select * from ptpos_explanations;
    
            ID      FR_ID PART_TYPE_ID POSITION_ID
    ---------- ---------- ------------ -----------
    PTPOS_LIST
    -----------------------------------------------------------------------------------------------------------------------------
        182527        100           10           1
    It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100
    
        182527        100           10           2
    It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100
    
        182527        110           20           1
    It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100
    
        182527        110           20           2
    It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100
    
    
    4 rows selected.
    
    

    Can I use LISTAGG on ptpos_list to refine the results.

    SELECT  id, part_type_id, LISTAGG(ptpos_list,', ') WITHIN GROUP(ORDER BY ptpos_list) recommendations
    FROM     ptpos_explanations
    GROUP BY id, part_type_id ;
    
    
            ID PART_TYPE_ID
    ---------- ------------
    RECOMMENDATIONS
    -----------------------------------------------------------------------------------------------------------------------------
        182527           10
    It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100, It seems like it was replaced by part_type(
    s)/position(s):10/1 from content: 100
    
        182527           20
    It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100, It seems like it was replaced by part_type(
    s)/position(s):20/2 from content: 100
    
    
    

    However, there are duplicates in the recommendations. I tried to wrap LISTAGG inside a REGEXP_REPLACE function, without much success.

    Here the final result, so I'm looking for:

            ID PART_TYPE_ID
    ---------- ------------
    RECOMMENDATIONS
    ---------------------------------------------------------------------------------
        182527           10
    It seems like it was replaced by part_type(s)/position(s):10/1 from content: 100
    
        182527           20
    It seems like it was replaced by part_type(s)/position(s):20/2 from content: 100
    
    
    

    EDIT: There are "n" lines for ptpos_list. So, we need to manage the many values of ptpos_list.

    Hello

    This is a feature annoying LISTAGG - you cannot use DIFFERENT with her.

    A workaround is to to a separate GROUP BY, or SELECT DISTINCT simply get the unique values, then call LISTAGG on these unique results, like this:

    WITH got_distinct_ptpos_list AS

    (

    SELECT id, part_type_id, ptpos_list

    OF ptpos_explanations

    GROUP BY id, part_type_id, ptpos_list

    )

    SELECT id, part_type_id

    LISTAGG (ptpos_list, ',')

    THE Group (ORDER BY ptpos_list) in the form of recommendations

    OF got_distinct_ptpos_list

    GROUP BY id, part_type_id

    ;

    LISTAGG isn't the only way to get the desired results.  See https://oracle-base.com/articles/misc/string-aggregation-techniques for other ways to string aggregation, including a user-defined aggregate function and SYS_CONNECT_BY_PATH.

    REGEXP_REPLACE should work, too.  What exactly have you tried?  (However, it is probably more effective to get the unique results immediately the bat, rather than producing more than you want and then by doing something more to get rid of the duplicates).

  • Extract the XML tags and insert into the table

    Description:

    XML is under inert atmosphere in the table containing the xmltype column. Need to extract value from xml tag and insert into the table.
    Once the XML record Treaty must update the status as 'Y' in the base table

    Problem:
    There are multiple occurrences of some tags that need to be combined and stored in a single column to delineate the '-'. No. area of occurrence can vary for each record.
    There are a few encrypted column that I managed to convert decoded value. But used select distinct... XMLTYPE...
    GTT table is used to store the intermediate result and decoding and the concatenation of several tags occurred using TWG.

    1.No. multiple tag will vary how to extract those and concatenate them into a single column. I assumed his occrrence in 3 for example: < student >
    2. how to set the value NULL if no tag is not present. Tag in XML record number can vary. I know that the complete list of xmltags.
    3 data not found error for some xml documents.

    Kindly Assits how to achieve this.

    version: 11.2.0.3.0

    Table Base: temp_XML

    XML_ID NOT NULL NUMBER (28) - auto-increment using the sequence
    PUBLIC EVENT. Stores the XMLTYPE STORAGE BINARY - XML file
    DATE OF EVTDATE
    STATUS VARCHAR2 (3) DEFAULT ' don't

    Sample XML: Includes all the brands mentioned in the common procedure below.

    <? XML version = "1.0" encoding = "US-ASCII"? >

    "< event xmlns ="http://xmlextrac.test.com/object">."

    < data xmlns = "" >

    < object >

    <>units

    < unit > TLAS < / unit >

    < unit > ATLAS < / unit >

    < / units >

    < receiverNetworks >

    < receiverNetwork > ABSAZAJ0XXXX < / receiverNetwork >

    < / receiverNetworks >

    < correspondentIds >

    < correspondentId > #SWF - ABSAZAJ0XXX < / correspondentId >

    < / correspondentIds >

    < comment >

    < comment / >

    < comment / >

    < comment / >

    < comment / >

    < / comment >

    < memo >

    < memo > 28 < / memo >

    < / memos >

    < tuxedoPriority > 20 < / tuxedoPriority >

    sender <>Mike < / sender >

    < typeReseauId > Message < / typeReseauId >

    < maxRetry > 4 < / maxRetry >

    < msgSecuLevel > CBA < / msgSecuLevel >

    < quantity >

    < amount > 12 < / amount >

    < amount > 34 < / amount >

    < amount > 56 < / amount >

    < / amounts >

    < currencys >

    < currency > $ < / currency >

    < currency > EUR < / currency >

    INR < currency > < / currency >

    < / currencys >

    < msgDateVal > ARST123 < / msgDateVal >

    wder < direction > < / direction >

    < eventType > 113 < / eventType >

    < date > 1407431619 < / date >

    < eventDate > 1407431624 < / eventDate >

    < management > R < / direction >

    < msgRef > R950140807AB6CBE < / msgRef >

    < format > SWF < / size >

    < type > 950 < / type >

    R950140807AB6CBE < WALL > < / WALL >

    < bankingPriority / >

    FSDS < field.20 > < / field.20 >

    < texteType > FSS < / texteType >

    < applicationCode > OHS < / applicationCode >

    < company > KETH < / company >

    < endFct > MOE < / endFct >

    < rate > BAM < / flow >

    < subtype / >

    < text > DQo6MjA6R0wxNDA4MDcwMDA1MTMNCjoyNTo3M == < / text >

    < msgHeaders > ezE6RjAxTE9ZRE5MMjBCWFhYMDAzMjAw = < / msgHeaders >

    < msgTrailer > ezU6e0NISzpEOUFFRUNCN0NBQTl9e1RORzp9fQ == < / msgTrailer >

    < / object >

    < / data >

    Procedure: This works very well for a few xml record and fails for some.

    CREATE OR REPLACE PROCEDURE XML_EXTR
    AS
    CURSOR c1
    IS
    SELECT * FROM temp_XML;

    c1_cur c1% ROWTYPE;

    bamdata_sql VARCHAR2 (3000);
    d_text VARCHAR2 (3000);
    d_msgHeaders VARCHAR2 (3000);
    d_msgTrailer VARCHAR2 (3000);
    x_text VARCHAR2 (3000);
    x_msgHeaders VARCHAR2 (3000);
    x_msgTrailer VARCHAR2 (3000);
    x_eventType VARCHAR2 (3000);
    x_amount number (28.2).
    x_currency VARCHAR2 (3000);
    x_state VARCHAR2 (3000);
    x_units VARCHAR2 (3000);
    x_correspondentId VARCHAR2 (3000);
    X_TYPE VARCHAR2 (3000);
    x_receiverNetworks VARCHAR2 (3000);
    x_bankingPriority VARCHAR2 (3000);
    x_applicationCode VARCHAR2 (3000);
    x_processCounter VARCHAR2 (3000);
    x_obsolescence VARCHAR2 (3000);
    x_maxRetry VARCHAR2 (3000);
    x_retries VARCHAR2 (3000);
    x_fileSize VARCHAR2 (3000);
    x_endFct VARCHAR2 (3000);
    x_subType VARCHAR2 (3000);
    x_field20 VARCHAR2 (3000);
    x_sequenceNumber VARCHAR2 (3000);
    x_requestorDn VARCHAR2 (3000);
    x_responderDn VARCHAR2 (3000);
    x_SWIFTNetService VARCHAR2 (3000);
    x_transfertRef VARCHAR2 (3000);
    x_nonrepudiation VARCHAR2 (3000);
    x_transfertInfo VARCHAR2 (3000);
    x_fileDesc VARCHAR2 (3000);
    x_transfertDesc VARCHAR2 (3000);
    x_logicalName VARCHAR2 (3000);
    x_signIndicator VARCHAR2 (3000);
    x_critId VARCHAR2 (3000);
    x_inFapId VARCHAR2 (3000);
    x_deliveryNotif VARCHAR2 (3000);
    x_comment1 VARCHAR2 (3000);
    x_comment2 VARCHAR2 (3000);
    x_comment3 VARCHAR2 (3000);
    x_comment4 VARCHAR2 (3000);
    x_comments VARCHAR2 (3000);
    x_memo1 VARCHAR2 (3000);
    x_memo2 VARCHAR2 (3000);
    x_memo3 VARCHAR2 (3000);
    x_memo4 VARCHAR2 (3000);
    x_msgSecuLevel VARCHAR2 (3000);
    x_dates VARCHAR2 (3000);
    x_tuxedoPriority VARCHAR2 (3000);
    x_fileDest VARCHAR2 (3000);
    x_stkMsgPDEId VARCHAR2 (3000);
    x_EMTId VARCHAR2 (3000);
    x_LTRcptSyno VARCHAR2 (3000);
    x_LTRcpt VARCHAR2 (3000);
    x_LTEmis VARCHAR2 (3000);
    x_flow VARCHAR2 (3000);
    x_FINCopy VARCHAR2 (3000);
    x_msgDateVal VARCHAR2 (3000);
    x_eventDate VARCHAR2 (3000);
    x_typeReseauId VARCHAR2 (3000);
    x_inFapSeq1 VARCHAR2 (3000);
    x_inFapSeq2 VARCHAR2 (3000);
    x_direction VARCHAR2 (3000);
    x_priority VARCHAR2 (3000);
    x_ack VARCHAR2 (3000);
    x_format VARCHAR2 (3000);
    x_mur VARCHAR2 (3000);
    x_TexteType VARCHAR2 (3000);
    x_creatingUser VARCHAR2 (3000);
    x_fileinfo VARCHAR2 (3000);
    x_company VARCHAR2 (3000);
    x_language VARCHAR2 (3000);
    x_ackText VARCHAR2 (3000);
    x_jaxbRef VARCHAR2 (3000);
    x_jaxbElt VARCHAR2 (3000);
    x_memos VARCHAR2 (3000);
    xmlid number (28);
    x_msgRef1 VARCHAR2 (3000);
    x_msgRef2 VARCHAR2 (3000);
    x_msgRef3 VARCHAR2 (3000);
    x_msgRef4 VARCHAR2 (3000);
    x_sender VARCHAR2 (3000);
    x_amlBehavior VARCHAR2 (3000);
    x_ownerServiceId VARCHAR2 (3000);
    x_correspondentName VARCHAR2 (3000);
    x_correspondentAddress1 VARCHAR2 (3000);
    x_correspondentAddress2 VARCHAR2 (3000);
    x_correspondentAddress3 VARCHAR2 (3000);
    x_correspondentAddress4 VARCHAR2 (3000);
    x_correspondentCity VARCHAR2 (3000);
    x_correspondentCountry VARCHAR2 (3000);
    x_correspondentNetworkAddr VARCHAR2 (3000);
    x_tested VARCHAR2 (3000);
    x_correspondentNetwork VARCHAR2 (3000);
    x_validatedPercentage VARCHAR2 (3000);
    x_nbOfValid VARCHAR2 (3000);
    x_requestRef VARCHAR2 (3000);
    x_notifQueue VARCHAR2 (3000);
    x_requestType VARCHAR2 (3000);
    x_secBpid VARCHAR2 (3000);
    x_queue VARCHAR2 (3000);
    x_receiverCode VARCHAR2 (3000);
    x_receiverInd VARCHAR2 (3000);
    x_validFlag VARCHAR2 (3000);
    x_ownerId VARCHAR2 (3000);
    x_dn VARCHAR2 (3000);
    x_RMAOurBic VARCHAR2 (3000);
    x_RMACorrespondentBic VARCHAR2 (3000);
    x_RMAService VARCHAR2 (3000);
    x_fileMsgRef VARCHAR2 (3000);
    date of x_ext_date;
    x_correspondentAddress VARCHAR2 (3000);
    x_msgrefs varchar2 (3000);
    d_ackText varchar2 (3000);
    ackText varchar2 (3000);
    date of x_extdate;

    BEGIN

    FOR C1_CUR IN C1

    LOOP

    INSERT INTO data_GTT_TEMP)
    eventType, amount, currency, State, units, correspondentId, sender, receiverNetworks, bankingPriority, applicationCode, processCounter.
    obsolescence, maxRetry, reminders, fileSize, endFct, xsubType, field.20, sequenceNumber, requestorDn, responderDn, SWIFTNetService, non-repudiation,
    transfertRef, transfertInfo, fileDesc, transfertDesc, logicalName, signIndicator, critId, inFapId, deliveryNotif, comment1, comment2, comment3, comment4,
    Memo1, memo2, memo3, memo4, msgSecuLevel, dates, tuxedoPriority, fileDest, stkMsgPDEId, EMTId, LTRcptSyno, LTRcpt, LTEmis, flow, FINCopy, msgDateVal,
    eventDate, typeReseauId, inFapSeq1, inFapSeq2, direction, priority, ack,
    msgRef1, msgRef2, msgRef3, msgRef4, amlbehavior, correspondentName, ownerServiceId,
    correspondentAddress1, correspondentAddress2, correspondentAddress3, correspondentAddress4,
    correspondentCity, correspondentCountry, correspondentNetworkAddr, tested,
    correspondentNetwork, validatedPercentage, nbOfValid, requestRef, notifQueue,
    requestType, secBpid, xqueue, receiverCode, receiverInd, validFlag, ownerId, dn, RMAOurBic, RMACorrespondentBic, RMAService,
    fileMsgRef, format, xtype, wall, TexteType, creatingUser, fileinfo,
    company, text, xlanguage, ackText, msgHeaders, msgTrailer, jaxbRef, jaxbElt)
    SELECT
    x.eventType, x.amount, x.currency, x.state, x.units, x.correspondentId, x.sender, x.receiverNetworks, x.bankingPriority, x.applicationCode, x.processCounter,
    x.obsolescence, x.maxRetry, x.Retries, x.FileSize, x.endFct, x.xsubType, x.Field20, x.SequenceNumber, x.requestorDn, x.responderDn, x.SWIFTNetService, x.nonRepudiation,
    x.transfertRef, x.transfertInfo, x.fileDesc, x.transfertDesc, x.logicalName, x.signIndicator, x.critId, x.inFapId, x.deliveryNotif, x.comment1, x.comment2,
    x.comment3, x.comment4, x.Memo1, x.memo2, x.memo3, x.MEMO4, x.msgSecuLevel, x.dates, x.tuxedoPriority, x.fileDest, x.stkMsgPDEId, x.EMTId, x.LTRcptSyno,
    x.LTRcpt, x.LTEmis, x.flow, x.FINCopy, x.msgDateVal, x.eventDate, x.typeReseauId, x.inFapSeq1, x.inFapSeq2, x.direction, x.priority, x.ack,
    x.msgRef1, x.msgRef2, x.msgRef3, x.msgRef4, x.amlbehavior, x.correspondentName, x.ownerServiceId,
    x.correspondentAddress1, x.correspondentAddress2, x.correspondentAddress3, x.correspondentAddress4,
    x.correspondentCity, x.correspondentCountry, x.correspondentNetworkAddr, x.tested,
    x.correspondentNetwork, x.validatedPercentage, x.nbOfValid, x.requestRef, x.notifQueue,
    x.requestType, x.secBpid, x.xqueue, x.receiverCode, x.receiverInd, x.validFlag, x.ownerId, x.dn, x.RMAOurBic, x.RMACorrespondentBic, x.RMAService,
    x.fileMsgRef, x.format, x.xtype, x.mur, x.TexteType, x.creatingUser, x.fileinfo,
    x.Company, x.Text, x.xLanguage, x.ackText, x.msgHeaders, x.msgTrailer, x.jaxbRef, x.jaxbElt

    of temp_XML t, XMLTABLE (XMLNAMESPACES ('http://xmlextrac.test.com/object' as "ns0"), ' / ns0:event' )
    PASSAGE t.BAM_EVENT COLUMNS
    eventType varchar2 (3000) PATH 'data, object, eventType' DEFAULT NULL,
    amount number (28.2) path data/object/amounts"."
    currency varchar2 (3000) PATH 'data, object, currencys, currency' DEFAULT NULL,
    VARCHAR2 (3000) path "data/object / / state of ' DEFAULT NULL, State
    units varchar2 (3000) PATH ' object/data/units' DEFAULT NULL,
    correspondentId varchar2 (3000) PATH "data/object/correspondentIds' DEFAULT NULL,
    sender varchar2 (3000) PATH 'data, object, sender' DEFAULT NULL,
    receiverNetworks varchar2 (3000) PATH "data/object/receiverNetworks' DEFAULT NULL,
    bankingPriority varchar2 (3000) PATH "data/object/bankingPriority' DEFAULT NULL,
    applicationCode varchar2 (3000) PATH ' object/data/applicationCode' DEFAULT NULL,
    processCounter varchar2 (3000) PATH "data/object/processCounter' DEFAULT NULL,
    obsolescence varchar2 (3000) PATH ' data/object/obsolescence' DEFAULT NULL,
    maxRetry varchar2 (3000) PATH ' data/object/maxRetry' DEFAULT NULL,
    attempts to varchar2 (3000) "data/object/attempts" DEFAULT NULL path,.
    size of the file varchar2 (3000) PATH ' data/object/fileSize' DEFAULT NULL,
    endFct varchar2 (3000) PATH "data/object/endFct' DEFAULT NULL,
    xsubType varchar2 (3000) PATH "data/object/subtype' DEFAULT NULL,
    field.20 varchar2 (3000) PATH ' object/data/field.20' DEFAULT NULL,
    sequenceNumber varchar2 (3000) PATH "data/object/sequenceNumber" DEFAULT NULL,
    requestorDn varchar2 (3000) PATH "data/object/requestorDn' DEFAULT NULL,
    responderDn varchar2 (3000) PATH "data/object/responderDn' DEFAULT NULL,
    SWIFTNetService varchar2 (3000) PATH "data/object/SWIFTNetService' DEFAULT NULL,
    non-repudiation varchar2 (3000) PATH ' object/data/repudiation' DEFAULT NULL,
    transfertRef varchar2 (3000) PATH "data/object/transfertRef' DEFAULT NULL,
    transfertInfo varchar2 (3000) PATH "data/object/transfertInfo' DEFAULT NULL,
    fileDesc varchar2 (3000) PATH "data/object/fileDesc' DEFAULT NULL,
    transfertDesc varchar2 (3000) PATH "data/object/transfertDesc' DEFAULT NULL,
    logicalName varchar2 (3000) PATH "data/object/logicalName" DEFAULT NULL,
    signIndicator varchar2 (3000) PATH "data/object/signIndicator' DEFAULT NULL,
    critId varchar2 (3000) PATH "data/object/critId' DEFAULT NULL,
    inFapId varchar2 (3000) PATH "data/object/inFapId' DEFAULT NULL,
    deliveryNotif varchar2 (3000) PATH "data/object/deliveryNotif' DEFAULT NULL,
    COMMENT1 varchar2 (3000) PATH ' data, subject, comments, comment [1] "DEFAULT NULL,
    comment2 varchar2 (3000) PATH 'data, subject, comments, how [2]' DEFAULT NULL,
    comment3 varchar2 (3000) PATH "data/object/observations/comments [3]" DEFAULT NULL,
    comment4, varchar2 (3000) PATH ' data, subject, comments, comment [4] "DEFAULT NULL,
    Memo1 varchar2 (3000) PATH "data/object/memos/memo [1]" DEFAULT NULL,
    Memo2 varchar2 (3000) PATH "data/object/notes/Notes [2]" DEFAULT NULL,
    memo3 varchar2 (3000) PATH "data/object/memos/memo [3]" DEFAULT NULL,
    MEMO4 varchar2 (3000) PATH "data/object/memos/memo [4]" DEFAULT NULL,
    msgSecuLevel varchar2 (3000) PATH "data/object/msgSecuLevel' DEFAULT NULL,
    Date varchar2 (3000) PATH ' object/data/date' DEFAULT NULL,
    tuxedoPriority varchar2 (3000) PATH "data/object/tuxedoPriority' DEFAULT NULL,
    fileDest varchar2 (3000) PATH "data/object/fileDest' DEFAULT NULL,
    stkMsgPDEId varchar2 (3000) PATH "data/object/stkMsgPDEId' DEFAULT NULL,
    EMTId varchar2 (3000) PATH "data/object/EMTId' DEFAULT NULL,
    LTRcptSyno varchar2 (3000) PATH "data/object/LTRcptSyno' DEFAULT NULL,
    LTRcpt varchar2 (3000) PATH "data/object/LTRcpt' DEFAULT NULL,
    LTEmis varchar2 (3000) PATH "data/object/LTEmis' DEFAULT NULL,
    flow varchar2 (3000) PATH "/ object/data flow ' DEFAULT NULL,
    FINCopy varchar2 (3000) PATH ' data/object/FINCopy' DEFAULT NULL,
    msgDateVal varchar2 (3000) PATH "data/object/msgDateVal' DEFAULT NULL,
    eventDate varchar2 (3000) PATH "data/object/eventDate" DEFAULT NULL,
    typeReseauId varchar2 (3000) PATH "data/object/typeReseauId' DEFAULT NULL,
    inFapSeq1 varchar2 (3000) PATH "data/object/inFapSeq1' DEFAULT NULL,
    inFapSeq2 varchar2 (3000) PATH "data/object/inFapSeq2' DEFAULT NULL,
    direction varchar2 (3000) PATH 'data, object, direction' DEFAULT NULL,
    priority varchar2 (3000) PATH ' data/object/priority' DEFAULT NULL,
    ACK varchar2 (3000) PATH ' object/data/ack' DEFAULT NULL,
    msgRef1 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [1] "DEFAULT NULL,
    msgRef2 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [2] "DEFAULT NULL,
    msgRef3 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [3] "DEFAULT NULL,
    msgRef4 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [4] "DEFAULT NULL,
    amlBehavior varchar2 (3000) PATH "data/object/amlBehavior' DEFAULT NULL,
    ownerServiceId varchar2 (3000) PATH "data/object/ownerServiceId' DEFAULT NULL,
    correspondentName varchar2 (3000) PATH ' data/object/correspondentName' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress1 ' object/data/correspondentLine1Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress2 ' object/data/correspondentLine2Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress3 ' object/data/correspondentLine3Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress4 ' object/data/correspondentLine4Addresse' DEFAULT NULL,
    correspondentCity PATH VARCHAR2 (3000) ' object/data/correspondentCity' DEFAULT NULL,
    correspondentCountry PATH VARCHAR2 (3000) ' object/data/correspondentCountry' DEFAULT NULL,
    correspondentNetworkAddr PATH VARCHAR2 (3000) ' object/data/correspondentNetworkAddr' DEFAULT NULL,
    tested VARCHAR2 (3000) PATH ' data/object/tested' DEFAULT NULL,
    correspondentNetwork PATH VARCHAR2 (3000) ' object/data/correspondentNetwork' DEFAULT NULL,
    validatedPercentage PATH VARCHAR2 (3000) ' object/data/validatedPercentage' DEFAULT NULL,
    nbOfValid PATH VARCHAR2 (3000) ' object/data/nbOfValid' DEFAULT NULL,
    requestRef VARCHAR2 (3000) PATH ' data/object/requestRef' DEFAULT NULL,
    notifQueue PATH VARCHAR2 (3000) ' object/data/notifQueue' DEFAULT NULL,
    requestType PATH VARCHAR2 (3000) ' data/object/requestType' DEFAULT NULL,
    secBpid PATH VARCHAR2 (3000) ' object/data/secBpid' DEFAULT NULL,
    xqueue PATH VARCHAR2 (3000) ' data/object/tail' DEFAULT NULL,
    receiverCode PATH VARCHAR2 (3000) ' object/data/receiverCode' DEFAULT NULL,
    receiverInd PATH VARCHAR2 (3000) ' object/data/receiverInd' DEFAULT NULL,
    validFlag PATH VARCHAR2 (3000) ' object/data/validFlag' DEFAULT NULL,
    ownerId PATH VARCHAR2 (3000) ' data/object/ownerId' DEFAULT NULL,
    DN VARCHAR2 (3000) PATH ' data/object/dn' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMAOurBic ' object/data/RMAOurBic' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMACorrespondentBic ' object/data/RMACorrespondentBic' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMAService ' object/data/RMAService' DEFAULT NULL,
    fileMsgRef PATH VARCHAR2 (3000) ' object/data/fileMsgRef' DEFAULT NULL,
    ackText varchar2 (3000) PATH "data/object/ackText' DEFAULT NULL,
    format varchar2 (3000) PATH "data/object / ' DEFAULT NULL,
    xType varchar2 (3000) PATH ' data/object/type' DEFAULT NULL,
    Wall varchar2 (3000) PATH ' data/object/wall' DEFAULT NULL,
    texteType varchar2 (3000) PATH "data/object/texteType' DEFAULT NULL,
    creatingUser varchar2 (3000) PATH ' data/object/creatingUser' DEFAULT NULL,
    fileInfo varchar2 (3000) PATH ' data/object/fileInfo' DEFAULT NULL,
    VARCHAR2 (3000) path ' data/object/society' DEFAULT NULL, the company
    VARCHAR2 (3000) text ' data/object/text' DEFAULT NULL path.
    xLanguage varchar2 (3000) PATH ' data/object/language' DEFAULT NULL,
    msgHeaders varchar2 (3000) PATH "data/object/msgHeaders' DEFAULT NULL,
    msgTrailer varchar2 (3000) PATH "data/object/msgTrailer' DEFAULT NULL,
    jaxbRef varchar2 (3000) PATH ' info/jaxbRef' DEFAULT NULL,
    jaxbElt varchar2 (3000) PATH "jaxbElt/info") x
    where t.XML_ID = c1_cur. XML_ID and t.status =' no;

    Select x.text, x.msgHeaders, x.msgTrailer in x_msgTrailer, x_msgHeaders, x_text of
    temp_XML t, XMLTABLE (XMLNAMESPACES ('http://xmlextrac.test.com/object' as "ns0"), ' / ns0:event' )
    PASSAGE t.BAM_EVENT COLUMNS
    text varchar2 (3000) PATH data/object/text"."
    msgHeaders varchar2 (3000) PATH "data/object/msgHeaders,"
    msgTrailer varchar2 (3000) PATH "object/data/msgTrailer.
    ) x
    where t.XML_ID = c1_cur. XML_ID;
    Select sysdate in double x_extdate;


    d_text: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_text)));
    d_msgHeaders: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_msgHeaders)));
    d_msgTrailer: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_msgTrailer)));
    -d_ackText: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (ackText)));

    Select
    EventType, amount, currency, State, units, correspondentid, sender, receivernetworks, bankingpriority,
    applicationcode, processcounter, obsolescence, maxretry, reminders, filesize, endfct, xsubtype, field.20, sequencenumber, requestordn,
    responderdn, swiftnetservice, non repudiation, transfertref, transfertinfo, filedesc, transfertdesc, logicalname, signindicator,
    critid, infapid, deliverynotif, comment1, comment2, comment3, comment4, memo1, memo2, memo3, memo4, msgseculevel, dates, tuxedopriority, filedest,
    stkmsgpdeid, emtid, ltrcptsyno, ltrcpt, ltemis, flow, fincopy, msgdateval, eventdate, typereseauid, infapseq1,
    infapseq2, direction, priority, ack, msgref1, msgref2, msgref3, msgref4, amlbehavior, ownerserviceid, correspondentname, correspondentaddress1, correspondentaddress2, correspondentaddress3, correspondentaddress4,
    correspondentcity, correspondentcountry, correspondentnetworkaddr, test, correspondentnetwork, validatedpercentage, nbofvalid,.
    requestref, notifqueue, requesttype, secbpid, xqueue, receivercode, receiverind, validflag, ownerid, dn, rmaourbic, rmacorrespondentbic, rmaservice, filemsgref,
    acktext, format, xtype, wall, textetype, creatinguser, fileinfo, society, text, xlanguage, msgheaders, msgtrailer, jaxbref, jaxbelt
    in
    x_eventtype, x_amount, x_currency, x_state, x_units, x_correspondentid, x_sender, x_receivernetworks, x_bankingpriority, x_applicationcode, x_processcounter,
    x_obsolescence, x_maxretry, x_retries, x_filesize, x_endfct, x_subtype, x_field20, x_sequencenumber, x_requestordn, x_responderdn, x_swiftnetservice, x_nonrepudiation,
    x_transfertref, x_transfertinfo, x_filedesc, x_transfertdesc, x_logicalname, x_signindicator, x_critid, x_infapid, x_deliverynotif, x_comment1, x_comment2, x_comment3,
    x_comment4, x_memo1, x_memo2, x_memo3, x_memo4, x_msgseculevel, x_dates, x_tuxedopriority, x_filedest, x_stkmsgpdeid, x_emtid, x_ltrcptsyno, x_ltrcpt,
    x_ltemis, x_flow, x_fincopy, x_msgdateval, x_eventdate, x_typereseauid, x_infapseq1, x_infapseq2, x_direction, x_priority, x_ack, x_msgref1, x_msgref2,
    x_msgref3, x_msgref4, x_amlbehavior, x_ownerserviceid, x_correspondentname, x_correspondentaddress1, x_correspondentaddress2, x_correspondentaddress3,
    x_correspondentaddress4, x_correspondentcity, x_correspondentcountry, x_correspondentnetworkaddr, x_tested, x_correspondentnetwork, x_validatedpercentage,
    x_nbofvalid, x_requestref, x_notifqueue, x_requesttype, x_secbpid, x_queue, x_receivercode, x_receiverind, x_validflag, x_ownerid, x_dn, x_rmaourbic,
    x_rmacorrespondentbic, x_rmaservice, x_filemsgref, x_acktext, x_format, x_type, x_mur, x_textetype, x_creatinguser, x_fileinfo, x_company, x_text,
    x_language, x_msgheaders, x_msgtrailer, x_jaxbref, data_GTT_TEMP x_jaxbelt;

    x_memos: = x_memo1 | » -'|| x_memo2 | » -'|| x_memo3 | » -'|| x_memo4;
    x_comments: = x_comment1 | » -'|| x_comment2 | » -'|| x_comment3 | » -'|| x_comment4;
    x_correspondentAddress: = x_correspondentAddress1 | » -'|| x_correspondentAddress2 | » -'|| x_correspondentAddress3 | » -'|| x_correspondentAddress4;
    x_msgrefs: = x_msgRef1 | » -'|| x_msgRef2 | » -'|| x_msgRef3 | » -'|| x_msgRef4;

    BEGIN


    insert into donnees_xml
    (xml_id, x_ext_date, eventtype, amount, currency, State, unit, correspondentid, sender, receivernetworks, bankingpriority, applicationcode,
    ProcessCounter, obsolescence, maxretry, reminders, filesize, endfct, xsubtype, field.20, sequencenumber, requestordn, responderdn,
    swiftnetservice, non repudiation, transfertref, transfertinfo, filedesc, transfertdesc, logicalname, signindicator, critid, infapid,
    deliverynotif, comments, notes, msgseculevel, dates, tuxedopriority, filedest, stkmsgpdeid, emtid, ltrcptsyno, ltrcpt, ltemis, flow,
    FINCopy, msgdateval, eventdate, typereseauid, infapseq1, infapseq2, direction, priority, ack, msgrefs, amlbehavior, ownerserviceid,
    correspondentName correspondentaddress, correspondentcity, correspondentcountry, correspondentnetworkaddr, tested,
    correspondentnetwork, validatedpercentage, nbofvalid, requestref, notifqueue, requesttype, secbpid, xqueue, receivercode,
    receiverind, validflag, ownerid, dn, rmaourbic, rmacorrespondentbic, rmaservice, filemsgref, acktext, format, xtype, wall,
    textetype, creatinguser, fileinfo, society, text, xlanguage, msgheaders, msgtrailer, jaxbref, jaxbelt)
    values
    (xmlid, x_extdate, x_eventType, x_amount, x_currency, x_state, x_units, x_correspondentId, x_sender, x_receiverNetworks, x_bankingPriority, x_applicationCode,
    x_processCounter, x_obsolescence, x_maxRetry, x_retries, x_fileSize, x_endFct, x_subType, x_field20, x_sequenceNumber, x_requestorDn, x_responderDn,
    x_SWIFTNetService, x_nonRepudiation, x_transfertRef, x_transfertInfo, x_fileDesc, x_transfertDesc, x_logicalName, x_signIndicator, x_critId, x_inFapId,
    x_deliveryNotif, x_comments, x_memos, x_msgSecuLevel, x_dates, x_tuxedoPriority, x_fileDest, x_stkMsgPDEId, x_EMTId, x_LTRcptSyno, x_LTRcpt, x_LTEmis, x_flow,
    x_FINCopy, x_msgDateVal, x_eventDate, x_typeReseauId, x_inFapSeq1, x_inFapSeq2, x_direction, x_priority, x_ack, x_msgrefs, x_amlbehavior, x_ownerServiceId,
    x_correspondentName, x_correspondentAddress, x_correspondentCity, x_correspondentCountry, x_correspondentnetworkaddr, x_tested,
    x_correspondentNetwork, x_validatedPercentage, x_nbOfValid, x_requestRef, x_notifQueue, x_requestType, x_secBpid, x_queue, x_receiverCode,
    x_receiverInd, x_validFlag, x_ownerId, x_dn, x_RMAOurBic, x_RMACorrespondentBic, x_RMAService, x_fileMsgRef, ackText, x_format, x_type, x_mur,
    x_TexteType, x_creatingUser, x_fileinfo, x_company d_text, x_language, d_msgHeaders, d_msgTrailer, x_jaxbRef, x_jaxbElt);

    Update temp_XML set status = 'Y' where XML_ID = xmlid;

    END;
    COMMIT;
    END LOOP;
    END;
    /

    1.No. multiple tag will vary how to extract those and concatenate them into a single column. I assumed that his occrrence in 3 for example:

    Use the fn:string-join() function:

    path varchar2 (4000) of comments 'string-join(comments/comment, "-").

    2. how to set the value NULL if no tag is not present. Tag in XML record number can vary.

    You don't have anything specific to do in this case.

    Missing tags with a projection in the COLUMNS clause will produce a column NULL by default.

  • At the bottom of the script explain briefly the example.

    Hello

    Someone at - it explain the request briefly with the example below. I am new to oracle, so I can't understand what they implemented in the script.

    Help me..!!!

    CREATE TYPE T24_DATEKEYPAIR AS OBJECT)

    DATE OF UPDATE,

    RECID VARCHAR2 (255));

    /

    CREATE THE OBJECT OF TYPE T24_KEYLIST AS (RECID VARCHAR2 (255));

    /

    CREATE TYPE T24_INTEMEDIATAB T24_DATEKEYPAIR TABLE IS

    /

    CREATE TYPE T24_INTEMEDIATABKEY T24_KEYLIST TABLE IS;

    /

    CREATE or REPLACE TYPE pipelined_stats_ot () AS OBJECT

    dummy_attribute NUMBER,

    FUNCTION ODCIGetInterfaces (STATIC)

    p_interfaces OUT SYS. ODCIObjectList

    ) RETURN NUMBER

    FUNCTION ODCIStatsTableFunction (STATIC)

    p_functionIN SYS. ODCIFuncInfo,

    p_stats OUT SYS. ODCITabFuncStats,

    p_args IN SYS. ODCIArgDescList,

    p_num_rowsIN NUMBER.

    ) RETURN NUMBER

    /

    CREATE or REPLACE TYPE pipelined_stats_ot BODY
    AS

    FUNCTION ODCIGetInterfaces (STATIC)

    p_interfaces OUT SYS. ODCIObjectList RETURN NUMBER) IS

    BEGIN

    p_interfaces: = SYS. () ODCIObjectList

    SYS. ODCIObject ("SYS", "ODCISTATS2"));

    RETURN ODCIConst.success;

    END ODCIGetInterfaces;

    Public STATIC FUNCTION ODCIStatsTableFunction (p_functionIN SYS. ODCIFuncInfo, p_stats OF THE SYS. ODCITabFuncStats, p_argsIN SYS. ODCIArgDescList,... p_num_rowsIN NUMBER...

    ) ETOURNER NUMBER IS

    BEGIN

    p_stats: = SYS. ODCITabFuncStats (p_num_rows);

    RETURN ODCIConst.success;

    END ODCIStatsTableFunction;

    END;

    /

    FUNCTION to CREATE or REPLACE T24_GetPURGEBatchKeyAndDate_OS (RECKEY VARCHAR2, p_num_rows in NUMBERS)

    RETURN T24_INTEMEDIATAB

    PIPELINED IS

    RTNVAL T24_DATEKEYPAIR;

    DELPOS INTEGER.

    LISTSTRING VARCHAR2 (4000);

    BEGIN

    SELECT XMLRECORD IN LISTSTRING OF V_F_RO_PURGE_KEYLIST WHERE RECID = RECKEY;

    LISTSTRING: = TRIM (LISTSTRING);

    WHILE LENGTH (LISTSTRING) <>0

    LOOP

    DELPOS: = INSTR (LISTSTRING, ' ');

    IF DELPOS = 0 THEN

    DELPOS: = LENGTH (LISTSTRING) + 1;

    END IF;

    SELECT T24_DATEKEYPAIR (TO_DATE (SUBSTR (LISTSTRING, 1, 8), 'YYYYMMDD'),
    SUBSTR (LISTSTRING, 9, DELPOS - 9)) IN THE DOUBLE RTNVAL;

    COURSE OF ACTION (RTNVAL);

    LISTSTRING: =.
    SUBSTR (LISTSTRING, DELPOS + 1, LENGTH (LISTSTRING) - DELPOS);

    END LOOP;

    RETURN;

    END T24_GetPURGEBatchKeyAndDate_OS;

    /

    CREATE or REPLACE FUNCTIONT24_GetPURGEBatchKey_OS (RECKEY VARCHAR2, p_num_rows in NUMBERS)

    RETURN T24_INTEMEDIATABKEY

    PIPELINED IS

    RTNVAL T24_KEYLIST;

    DELPOS INTEGER.

    LISTSTRING VARCHAR2 (4000);

    BEGIN

    SELECT XMLRECORD IN LISTSTRING FROMV_F_RO_PURGE_KEYLIST WHERE RECID = RECKEY;

    LISTSTRING: = TRIM (LISTSTRING);

    WHILE LENGTH (LISTSTRING) <>0

    LOOP

    DELPOS: = INSTR (LISTSTRING, ' ');

    IF DELPOS = 0 THEN

    DELPOS: = LENGTH (LISTSTRING) + 1;

    END IF;

    SELECT T24_KEYLIST (SUBSTR (LISTSTRING, 1, DELPOS-1)) IN THE DOUBLE RTNVAL;

    COURSE OF ACTION (RTNVAL);

    LISTSTRING: = SUBSTR (LISTSTRING, DELPOS + 1, LENGTH (LISTSTRING) - DELPOS);

    END LOOP;

    RETURN;

    END T24_GetPURGEBatchKey_OS;

    /

    ASSOCIATE the STATISTICS WITH FUNCTIONST24_GetPURGEBatchKeyAndDate_OS USING pipelined_stats_ot

    /

    ASSOCIATESTATISTICS WITH FUNCTIONS with the HELP of T24_GetPURGEBatchKey_OS pipelined_stats_ot

    /

    Purpose:

    This code is used for setting a bad schema design.

    That is to say a fool decided it was a good idea to store multiple values in a delimited string rather than store them properly in a child table.

    90% of the code is so that the CBO Gets the correct cardinality for Pipeline function instead of using the default value of 8196

    The other 10% converts the string into a "table" through the Pipeline feature.

    See:

    http://www.Oracle-Developer.NET/display.php?id=429

    Yes.  This example uses technical advance of coding.

    As you can see, it will be difficult for a new person to know what lack of comments in your code.

    MK

  • ORA-01460: letter dead or unreasonable conversion requested and INSTR func

    Hi all
    I have the table and the data, following the output of the query is correct but when the data inside the column gen_value more than
    4000 bytes.
    I am facing the following error
    ORA-01460:unimplemented or unreasonable conversion requested
    which include the function Instr can spend just less than 4000 bytes. So how can I solve this problem.
    drop table a;
    create table  a(id number(9), gen_value CLOB);
     
    insert into a values(1, 'ACD BCD AAA, AFD BCF , Egypt,BDE AAC AFC,Egypt,BCF AAE');
    insert into a values(2, 'AVF BCD, BBA BBG BCEV, GACD MNF BCV');
    insert into a values(3, 'AFC ABC, BBG HUH ABCE, Egypt,JHU KK MNK');
     
    declare 
    gen_value  varchar2(20000);
    id number(9);
    type bulk_collect is table of varchar2(500) index by PLS_INTEGER;
         v_bluk1 bulk_collect; 
         v_bluk2 bulk_collect; 
          v_bluk3 bulk_collect; 
    begin 
    
    select id,gen_value into id, gen_value from a where id=1;
    select id,v,cnt bulk collect into v_bluk1,v_bluk2,v_bluk3  from(
    with data as (
     select
      id
     , gen_value ||','  gen_value 
     from dual
    )
    ,r  (id,  gen_value , l) as (
     select  
      id
     ,substr( gen_value , instr( gen_value , ',') + 1)
     ,substr(
       trim(substr( gen_value ,1, instr( gen_value , ',') - 1))
      ,instr(trim(substr( gen_value ,1, instr( gen_value , ',') - 1)),' ',-1)
     )
    from data
    union all
     select  
      id
     ,substr( gen_value , instr( gen_value , ',') + 1)
     ,substr(
       trim(substr( gen_value ,1, instr( gen_value , ',') - 1))
      ,instr(trim(substr( gen_value ,1, instr( gen_value , ',') - 1)),' ',-1)
     )
    from r
    where
    length( gen_value ) > 0
    )
     select id,
     soundex(l)as l
    ,count(*) cnt
    ,trim(max(l) keep ( dense_rank last order by length(l), l desc nulls first)) v
    from r where l is not null
    group by
     soundex(l),id
     order by 1);
    for b in 1..v_bluk1.count loop 
     dbms_output.put_line ('The DOC NUMBER IS '||v_bluk1(b)||v_bluk2(b)||v_bluk3(b)); 
    
    end loop; 
    
    end;
    error is,
    ORA-01460:unimplemented or unreasonable conversion requested
    Which column includes more than 4000 bytes.
    concerning
    Benjamin

    Published by: 973907 on April 14, 2013 04:21

    Published by: 973907 on April 14, 2013 06:13

    Solomon Yakobson says:
    If you explain what your code is trying to accomplish, someone might offer an alternative solution.

    The column GEN_VALUE in table A is a CLOB containing the list separated by commas. Your code divides this list separated by commas into indivitual elements. If none of the elements of comma-separated string exceeds 4000 bytes, what you need is to change GEN_VALUE variable PL/SQL CLOB type and then cast individual items to VARCHAR2:

    declare
    gen_value  CLOB;
    id number(9);
    type bulk_collect is table of varchar2(500) index by PLS_INTEGER;
         v_bluk1 bulk_collect;
         v_bluk2 bulk_collect;
          v_bluk3 bulk_collect;
    begin 
    
    select id,gen_value into id, gen_value from a where id=1;
    select id,v,cnt bulk collect into v_bluk1,v_bluk2,v_bluk3  from(
    with data as (
     select
      id
     , gen_value ||','  gen_value
     from dual
    )
    ,r  (id,  gen_value , l) as (
     select
      id
     ,substr( gen_value , instr( gen_value , ',') + 1)
     ,substr(
       trim(substr( gen_value ,1, instr( gen_value , ',') - 1))
      ,instr(trim(substr( gen_value ,1, instr( gen_value , ',') - 1)),' ',-1)
     )
    from data
    union all
     select
      id
     ,substr( gen_value , instr( gen_value , ',') + 1)
     ,substr(
       trim(substr( gen_value ,1, instr( gen_value , ',') - 1))
      ,instr(trim(substr( gen_value ,1, instr( gen_value , ',') - 1)),' ',-1)
     )
    from r
    where
    length( gen_value ) > 0
    )
     select id,
     soundex(cast(l as VARCHAR2(4000))) as l
    ,count(*) cnt
    ,trim(max(cast(l as VARCHAR2(4000))) keep ( dense_rank last order by length(cast(l as VARCHAR2(4000))), cast(l as VARCHAR2(4000)) desc nulls first)) v
    from r where l is not null
    group by
     soundex(cast(l as VARCHAR2(4000))),id
     order by 1);
    for b in 1..v_bluk1.count loop
     dbms_output.put_line ('The DOC NUMBER IS '||v_bluk1(b)||v_bluk2(b)||v_bluk3(b)); 
    
    end loop; 
    
    end;
    /
    The DOC NUMBER IS 1AAA512
    The DOC NUMBER IS 1AFC256
    The DOC NUMBER IS 1BCF256
    The DOC NUMBER IS 1Egypt512
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    SY.

Maybe you are looking for

  • remembering ssh passphrases

    Before moving on to the Sierra, the first time I ran a ssh command every day, he would ask for my password and store the key, making it usable by any other ssh process, no matter where I am connected, thanks to the "forwarding agent. That's what I'm

  • Mini iPad 2 is safe to upgrade to iOS 9 yet?

    I have a mini iPad running iOS 8.4 2. I bought an Apple lightning for SD card reader, but apparently it works with ios 9. However, I fear that updating to iOS will cause performance problems. I've not updated until that now because of these concerns,

  • Just update iPad pro with 9.3. Unable to open Web pages from a link from bookmarks or within a Web site now

    Just updated iPad pro with 9.3 now impossible to open Web pages from a link, only from bookmarks or Web site

  • Good graphics card upgrade for HP Pavilion p7-1534?

    Hello I just got a new HP Pavilion p7-1534 for my birthday. I want to update my graphics card because I'm a big gamer, but I don't know where to start. What are some cards compatible with this system? It would be nice to be able to get one that will

  • My drivers cd/dvd does not.

    I tried Vista automated systems, and it said that my registry filters are missing or damaged. Sound also say the device has problems that are originally not not to work properly. I opened the registry change and filters are not there. Help, please.