split the file into 3 files xml txt

I am creating 3 xml from 1 file txt in javascript files.

I insofar as:

A file containing text:

GP0006896 # SunGold - 3 small # 00 NV ###Zespri Service Center # KLT0000110 # 16950 ###tray Kiwi SunGold pack of 3 small ###JWM # ZESPRI - 3 - D$ $$

GP0012816 # S500-R012336 # 00 ###Poppies Nederland BV # KLT0000081 # 17890 ###Plus slagroomsoes 250 g #JWM # CULI - 10 - B$ $$

GP0009000 ###test 01 # ###Just a test # KLT0001010 # 20596 ###Dit is een regel ###Standaard # TEST test - 01 - B$ $$

The script:

Set the variable

var txtfolderpath = app.path+'/XML_converter/';

var txtfilename = "txt_to_xml.txt";

var txtfilelocation = File (txtfolderpath + txtfilename);

var xmlfolderpath = app.path+'/XML_converter/xml/';

var retChar = eval (' string.fromCharCode(0)) (13)');

var presscancelbutton = 0;

AppVersion var = app.version;

var appversionarray = appversion.split('.');

AppVersion = new Number(appversionarray[0]);

xmlString = var ";

Scriptfolderpathcheck

#target illustrator

var pathcheck = File($.fileName).parent.fsName;

infopanelmenu();

function infopanelmenu() {}

Res =.

"dialog box {------}.

text: "TXT to XML format:', \"

Properties: {resizable: false},

margin: [0,0,0,0],

ImageGroup: group {orientation: 'stack', preferredSize: 400 (221) and alignChildren: 'low'------}

No.: group {orientation: 'column', margins: [0,0,0,20], \}

infopanelgroup: Panel {orientation: 'column', preferredSize: 360 (20) and alignChildren: 'top', text: "TXT to XML conversion,"------}

XmlGroup: group {orientation: 'row', alignment: 'left',------}

s: StaticText {text: "XML converted: '"},

S2: StaticText {text: '0'}, \

} \

statusgroup: group {orientation: 'row', alignment: 'left',------}

s: StaticText {text: "Status:"},

S2: StaticText {text: 'Ready to start'}, \

} \

} \

infopanelbuttons: group {orientation: "rank", align: 'center', \}

cancelBtn: button {text: 'Cancel', properties: {name: 'Cancel'}}, \

applyBtn: button {text: 'Start', properties: {name: 'apply'}}, \

} \

} \

} \

}";

WinInfo = new window (res);

wininfo.frameLocation = [100, 100];

Buttons

wininfo.imagegroup.jobgroup.infopanelbuttons.cancelBtn.onClick = function () {}

presscancelbutton = presscancelbutton - 1;

WinInfo. Close();

};

wininfo.imagegroup.jobgroup.infopanelbuttons.applyBtn.onClick = function () {}

BuildXml();

};

WinInfo. Center();

WinInfo. Show();

}

function buildxml() {}

txtfilelocation. Open ('read');

txtfile = txtfilelocation.read ();

XmlArray var = txtfile.split('$$$');

wininfo.ImageGroup.JobGroup.infopanelgroup.statusgroup.S2.Text = "Running";

wininfo.imagegroup.jobgroup.infopanelbuttons.applyBtn.text = "Running";

wininfo.imagegroup.jobgroup.infopanelbuttons.applyBtn.enabled = false;

To read none

for (i = 0; i < xmlarray.length - 1; i ++) {}

var subxmlarray is xmlarray [i].split('###');.

var counter = i + 1;

xmlString = var ";

xmlString = xmlstring + ' <? XML version = "1.0" encoding = "UTF-8"? > ' + retChar;

xmlString = xmlstring + "< xml >" + retChar;

xmlString = xmlstring + '< gp_number >' + subxmlarray [0] + "< / gp_number > ' + retChar;"

xmlString = xmlstring + '< Steckerhalter >' + subxmlarray [1] + "< / number > ' + retChar;"

xmlString = xmlstring + '< versienummer >' + subxmlarray [2] +' < / versienummer > ' + retChar;

xmlString = xmlstring + '< klantnaam >' + subxmlarray [3] +' < / klantnaam > ' + retChar;

xmlString = xmlstring + '< klantnummer >' + subxmlarray [4] +' < / klantnummer > ' + retChar;

xmlString = xmlstring + '< ID >' + subxmlarray [5] + ' / ID <>' + retChar;

xmlString = "< artikelomschrijving >" + xmlstring + subxmlarray [6] +' < / artikelomschrijving > ' + retChar;

xmlString = "< workflow >" + xmlstring + subxmlarray [7] +' < / workflow > ' + retChar;

xmlString = "< stans >" + xmlstring subxmlarray + [8] +' < / stans > ' + retChar;

xmlString = xmlstring + ' < / xml > '

wininfo.ImageGroup.JobGroup.infopanelgroup.XmlGroup.S2.Text = counter;

Alert (xmlString); / / see if the stingbuild works <-works here 3 times

Save the function

var filename = subxmlarray [0] + ".xml";

var xmlsavelocation = File (xmlfolderpath + filename);

xmlsavelocation. Open ('w');

xmlsavelocation.writeln (xmlString); / / Save the string <-works here 3 times, but generates two empty documents!

xmlsavelocation. Close();

}

txtfilelocation. Close();

wininfo.ImageGroup.JobGroup.infopanelgroup.statusgroup.S2.Text = "Ready"

wininfo.imagegroup.jobgroup.infopanelbuttons.applyBtn.text = "start";

wininfo.imagegroup.jobgroup.infopanelbuttons.applyBtn.enabled = true;

}

The output:

output.png

You will see that I get 3 files but 2 0 bytes.

The question:

Why can't I save the other two strings in an xml file?

Thank you, Daniel

Resolved:

Divide the return in the text thus file to do the work function stop.

Daniel

Tags: Illustrator

Similar Questions

  • splits the string into 3 parts

    Hello

    I have a requirement to split the string into 3 different room example inf.ethz.ch should be subdivided into inf ethz ch in 3 different column

    We have table called email within this column contains all identification of email we need to divide email with dot (.) in different columns and display please suggest how to implement in the query

    Thank you

    Sudhir

    Use REGEXP_SUBSTR:

    SQL > with t as (select ' inf.ethz.ch' double txt)
    2 Select regexp_substr (txt,'[^.] +') part_1,.
    3 regexp_substr (txt,'[^.] +', 1, 2) part_2,.
    4 regexp_substr (txt,'[^.] +' 1, 3) part_3
    5 t
    6.

    BY PARTY PA
    --- ---- --
    INF ethz ch

    SQL >

    Or you can use SUBSTR + Instr.

    SY.

  • Oracle regular expressions - splits the string into words for

    Hello

    Nice day!

    My requirement is to split the string into words.

    So I need to identify the new line character and the semicolon (;), comma and space like terminator for string entry.

    Please note that I am currently embedded blank and the comma as separator, as shown below.

    Select regexp_substr('test)
    TO
    string in words, "([^, [: blanc:]] +) (', 1, 1) double;"

    How to integrate the semicolons and line break characters in regular expression Oracle?

    Please notify.

    Thanks and greetings

    Sree

    This has nothing to do with REGEXP. Is SQL * more parser does not not a semicolon at the end of the line:

    SQL > select ' testto, mm\;
    ERROR:
    ORA-01756: city not properly finished chain

    SQL >

    Just break the chain:

    SQL > select regexp_substr ('testto, mm\;' |) '
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<= regexp_count('testto,mm\;'="" ||="">
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;' |') STRINGIN
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    Or modify SQL * more the character of endpoints:

    SQL > set sqlterm.
    SQL > select regexp_substr ('testto, mm\;)
    2 string into words
    3 \w+',1,level ',') of double
    4. connect by level<=>
    5 string in words
    6      ','\w+')
    7.

    REGEXP_SUBSTR ('TESTTO, MM\;) STRINGINTOWO
    --------------------------------------
    Testto
    mm
    string
    in
    Words

    SQL >

    SY.

  • Open the file server .txt and analysis

    I'm trying to open a .txt on my server and analyze the content, the content is a version number and a link.

    I have something like this

    ContentConnection updateConnection = null;
    
    try {
                updateConnection = (ContentConnection)             Connector.open(updateUrl);
    
              .....
    
             ......
    
       } catch (ConnectionNotFoundException e){
                e.printStackTrace();
            } catch (IOException e){
                e.printStackTrace();
            } catch  (IllegalArgumentException e){
                e.printStackTrace();
            }
    

    I'm capturing the IOException exception. Is it possible to open a txt file and analyzed. I can change the format of the file to something else if necessary. I thought that keeping it as a txt should be ok because I have to analyze only 2 pieces of information about him.

    Thank you.

    You can use

    http://www.BlackBerry.com/developers/docs/6.0.0api/NET/rim/device/API/IO/IOUtilities.html#streamToBy...

    to retrieve the file.

    create a string from the byte array and analyze its contents.

  • How to split the file by using the utl package in oracle.

    Hi all

    I want ot create several files with utl_file.

    Earlier, I'm writing itng cursor files together in a single file.

    But now we must divide it into several files when the cursor recrds exceeded 10000.

    So the file will become two if it crosses 10000 records Amend now

    If a cursor has 30000 records then I hould create 3 files.

    Here's how I wrote the simple logic to write the entire records from a single table.

    UTL_FILE. PUTF (File1, head);

    UTL_FILE.new_line (file1);

    FOR vcur_torico_fetch IN cur_torico_fetch

    LOOP

    stmt: = "

    || Chr (9) | »

    || Chr (9) | vcur_torico_fetch. Application_classification

    || Chr (9) | »

    || Chr (9) | »

    || Chr (9) | vcur_torico_fetch. MY_COMP_CODE

    || Chr (9) | vcur_torico_fetch. OU_org_code;

    UTL_FILE. PUTF (File1, stmt);

    UTL_FILE.new_line (file1);

    END LOOP;

    UTL_FILE.fclose (file1);

    Kindly let me know the logic to do this.

    Best regards

    Try this. I used object and I write 33333 lines. It will be writern in 4 files with lines of 10000, 10000, 10000 and 3333.

    SQL> declare  2    l_file         utl_file.file_type   default NULL;  3    l_row_per_file integer              default 10000;  4    l_file_name    varchar2(100)        default 'ALL_OBJECT_{FILENO}.CSV';  5    l_file_dir     varchar2(100)        default 'KARDIR';  6    l_file_no      integer              default 0;  7  begin  8    for i in (  9                select object_id 10                     , object_name 11                     , ceil(rownum/l_row_per_file) file_no 12                  from all_objects 13                 where rownum <= 33333 14             ) 15    loop 16        if l_file_no != i.file_no 17        then 18            if utl_file.is_open(l_file) 19            then 20               utl_file.fclose(l_file); 21            end if; 22 23            l_file_no := i.file_no; 24            l_file    := utl_file.fopen 25                         ( 26                              l_file_dir 27                            , replace(l_file_name, '{FILENO}', to_char(l_file_no, 'fm099999')) 28                            , 'w' 29                         ); 30        end if; 31 32        utl_file.put_line(l_file, i.object_id || ',' || i.object_name); 33     end loop; 34 35     if utl_file.is_open(l_file) 36     then 37        utl_file.fclose(l_file); 38     end if; 39  end; 40  /
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    In the unix box, check the file...

    % ls - lrt ALL_OBJECT knani *. CSV | AWK '{print $9} ' | XARGS wc-l
    10000 ALL_OBJECT_000001.CSV
    10000 ALL_OBJECT_000002.CSV
    10000 ALL_OBJECT_000003.CSV
    3333 ALL_OBJECT_000004.CSV
    33333 total
    knani %

  • FSG Patches - product is registered in the database, but the file (zsaprod.txt, jtsprod.txt) does not exist in APPL_TOP

    Hello

    I recently updated 12.1.3 and solve some problems and by Doc-ID 189282.1 -FSG paches, I install "Patch 17066098: R12.1: General Ledger Recommended Patch Collection (FSG), Sept 2013" which calls for the installation of ""Patch 16012307: Fsg Drilldown returns no data when using Ledger balances Mult set with " "

    Doc ID 189282.1 calls for three patches, 17066098:R12.RG.B, 16012307:R12.GL. B and 16266400:R12.RG.B

    I installed successfully 17066098:R12.RG.B

    Patch 16012307 failed on 1 worker with

    gl_drill_account_ranges_gt  FAILED

    Worker errors are:

    Worker AD cautions:

    Product data file

    /U02/applfind/apps/apps_st/appl/Admin/zsaprod.txt

    There is no product "zsa".

    This product is registered in the database, but the

    above the file does not exist in APPL_TOP.  The product

    will be ignored without error.

    Worker AD cautions:

    Product data file

    /U02/applfind/apps/apps_st/appl/Admin/jtsprod.txt

    There is no product "jts".

    This product is registered in the database, but the

    above the file does not exist in APPL_TOP.  The product

    will be ignored without error.

    How to solve this?

    Thank you

    Mathias

    Mathias,

    This mistake is addressed in the following documents.

    Patch 16012307 Down on GL_DRILL_ACCOUNT_RANGES_GT. XDF with error ORA-01722 and ORA-06512 (Doc ID 1573185.1)

    ACP: Patch Is Failing ORA - 01722 Xdf meets (Doc ID 1267587.1)

    Patch 12312729 Is not running because of the ORA-01722: invalid number (Doc ID 1356468.1)

    11.5.10.2 to 12.2.0 upgrade failed in the MEP files (Doc ID 1620806.1)

    Thank you

    Hussein

  • Import of text in the file XML, '\n' works not

    Hi I am looking to set up my game so it pulls in all the text in an external XML file (to switch between different languages easier). The problem is that several times, I need to use the special code "\n" to start a new line (for purposes of formatting) but when I'm pulling the text in from the XML file is not starts a new line-it appears just as usual in the text. (for example "this is some text example \n") How to do this?

    Here, any help appreciated, I'm supposed to finish everything by tomorrow so I need suggestions asap thank you haha.

    XML.ignoreWhitespace = false;

  • Problem with the translation into Chinese of msgrte.txt

    With the help of LabWindows/CVI 2012 SP1.

    I am trying to create a Chinese version of one of our applications. I have a msgrte.txt that has been translated into Chinese, and I ran countmsg.exe on update magic numbers. Countmsg.exe reports of success, and the numbers are changed.

    I replaced the following files with the new msgrte.txt for testing purposes:

    C:\Windows\SYSWOW64\cvirte\bin\msgrte.txt

    C:\Windows\SYSWOW64\cvirte\bin\msgrt4.txt

    C:\Windows\System32\cvirte\bin\msgrte.txt

    When I run the application, it blocks (unrecoverable error) whenever I do anything that requires the text in this file, for example a FileSelectPopup.

    If I use the standard version of English to msgrte.txt, the application works OK (though of course the standard popup panels have English text).

    An inspection of the eyeball of the msgrte.txt translated shows anything special on the file.

    Locale system is set to Chinese (simplified, China).

    Anyone has any ideas to identify the problem?

    I promised to report when a solution is found, so here it is:

    It turns out the format of at least some of the messages in msgrte.txt is critical and will result in the application crash if it is not correct. In my case, the message:

    1331 ' __All files (*.) " *)... »

    has been translated with a missing space character, that is to say (the Chinese equivalent of):

    1331 «files __All...»

    This message appears to be used as a filter in FileSelectPopup (and FileSelectPopupEx) specifier, so the space between the description and the designation of generic character is important.

    So if you translate msgrte.txt, be careful! If, like me, you find it translated by a third party in a language you don't understand, be doubly careful

  • splits the string into documents

    Hello

    I did a query (see regexp) that split a string into records. The problem with the query is the separate in the subquery. Otherwise, it returns millions of records where I expect less than a thousand.
    Meanwhile, I found an other solution (see xmlsequence), but this statement returns the message "ORA-03113: end of file on the communication channel.

    Please advice.

    regexp:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT distinct box_code, regexp_substr(box_pos,'[^,]+',1,level) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             )
             connect by level <= length(box_pos) - length(replace(box_pos,',')) + 1
        ) box
        WHERE smp.u_box_code = box.box_code
        AND smp.u_box_position = box.box_pos
    xmlsequence:
        SELECT smp.sample_id
        FROM
        (
            SELECT sa.sample_id, sau.u_box_code, sau.u_box_position
            FROM lims_sys.sdg sd, lims_sys.sdg_user sdu, lims_sys.sample sa, lims_sys.sample_user sau
            WHERE sd.sdg_id = sdu.sdg_id
            AND sd.sdg_id = sa.sdg_id
            AND sa.sample_id = sau.sample_id
            AND sau.u_padded_out = 'F'
            AND sdu.u_client_type =  decode('#Client#','-1',sdu.u_client_type,'#Client#')
            AND sdu.u_crop_group = decode('#Crop#','-1',sdu.u_crop_group,'#Crop#')
            AND sdu.u_year_of_sample_delivery = decode('#Year#',-1,sdu.u_year_of_sample_delivery,'#Year#')
            AND sdu.u_week_of_processing = decode('#Week#',-1,sdu.u_week_of_processing,'#Week#')
            AND sd.status IN ('V','P','C')
        ) smp,
        (
            SELECT  box_code, trim(x.column_value.extract('e/text()')) box_pos 
            FROM
            (
                 SELECT p.name box_code, substr(p.description,instr(p.description, 'NP=') + 3) box_pos
                 FROM lims_sys.plate_template pt, lims_sys.plate p, lims_sys.plate_user pu
                 WHERE pt.plate_template_id = p.plate_template_id
                 AND p.plate_id = pu.plate_id
                 AND pt.name = 'Box96'
                 AND p.status IN ('V','P','C')
                 AND p.description like '%NP=%'
                 AND pu.u_client_type = decode('#Client#','-1',pu.u_client_type,'#Client#')
                 AND pu.u_crop_group = decode('#Crop#','-1',pu.u_crop_group,'#Crop#')
                 AND pu.u_year = decode('#Year#',-1,pu.u_year,'#Year#')
                 AND pu.u_week = decode('#Week#',-1,pu.u_week,'#Week#')
             ) t, table (xmlsequence(xmltype('<e><e>' || replace(t.box_pos,',','</e><e>')|| '</e></e>').extract('e/e'))) x
        ) box
        WHERE smp.u_box_code = box.box_code

    Hello

    When 'LEVEL '.<= x"="" is="" the="" only="" connect="" by="" condition,="" then="" you="" should="" be="" using="" a="" table="" that="" has="" only="" one="" row,="" like="">

    You can generate a Table of counters (a result set, in fact) who has all the integers that you need and then join one.
    The next thread is an example:
    I don't don't want to mark in plsql

  • Is the file XML of AE full functionality?

    Hi good friends at Adobe-

    Is there a roadmap or the XML AE project file information? I'm curious if it will develop everything and I'd love to know if we can expect to exhibit more non binary data at any given time.

    Thanks for any input-

    F

    Our intention is to extend the format to include more features based on customer requests. Here is the link where you can vote and submit your request.

  • Edit the file Extensions.txt on VISTA

    OS = Vista Edition Home Premium

    When I edit the Extensions.txt file in C:\Program Files\Adobe\... Dreamweaver CS\configuration and restart Dw does not show my changes.

    It seems that the edited real Extensions.txt location proves to be: files C:\Users\[USER]\Local\VirtualStore\Program...
    This is also the case when logged in as an administrator.

    Each user to view their own Extensions.txt file, Dw sees none of them?

    Found:
    Located on vista, custom user configuration in c:\Users\[USER]\AppData\Roaming\Adobe\Dreamweaver9\Configuration
    Useful info:
    http://www.Adobe.com/cfusion/knowledgebase/index.cfm?id=kb401118

  • What is the file version.txt - locked

    Whenever I reboot on my iMac, I get this "version.txt - locked" window is... attached a screenshot on my desk.  How can I get rid of this?  Any help would be appreciated. Thank you!

    So look in the preferences system - users and groups - select your user name, then click the login items tab. You can see some tips there.

  • SQL / PLSQL to split the string into pieces

    Hi all

    I have a problem of data conversion from the name of one table to another structure.

    for example

    SQL > desc names
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    TITLE VARCHAR2 (5)
    FNAME VARCHAR2 (20)
    LNAME VARCHAR2 (20)

    SQL > Data desc
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    FULLNAME VARCHAR2 (50)


    Insert in data values ("SIR I HAVE ONE NAME PARTICULARLY LONG INDEED");
    Insert in the data values ("MINE IS EVEN MORE, ENOUGH RIDICULEMENT so IN FACT");

    Essentially, I need to divide these names long, stored in the 1 field, in the above 3 fields. The trickiest part is however I want to do it in such a way so that if the 1st part of the name fits the 1 5 char field I want to do, otherwise I would divide between 2 fields - once again without splitting a string. The reason behind this is that application will automatically put a space between each field when they appear and I would avoid gaps in the names if possible.

    This baffled me a little if any help would be seriously great... it might not even be a go-er, as it might be too uneconomic with the amount of available space, but I would give it a shot.

    Thank you!
    Adam

    Hi, Adam.

    Use regular expressions:

    INSERT INTO names (title, fname, lname)
    SELECT  RTRIM (REGEXP_SUBSTR ( fullname
                              , '^.{1,5} '
                        )
               )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20})'       ||     -- \2       = 1-20 letters
                    '(( .*)|$)'          -- \3-\4 = space (plus anything) or end
                     , '\2'
                     )
    ,     REGEXP_REPLACE ( fullname
                     , '(^.{1,5} )?'       ||     -- \1      = optional 1-5-letter word(s)
                           '(.{1,20}( |$))' ||     -- \2-\3 = 1-20 letters and space or end
                           '(.{1,20})?'       ||     -- \4       = 0-20 letters
                    '(( .*)|$)'          -- \5       = space (plus anything) or end
                     , '\4'
                     )
    FROM     data_table          -- data is not a good name
    ;
    

    Published by: Frank Kulash, August 18, 2009 11:13
    Revised to manage long single word fullname

  • Need help to split the string into two fields

    Can someone share your thoughts by dividing the prod_info string below into two fields

    For example:-TABLE of PROD

    SOURCE TABLE

    SNO PROD_INFO
    120 OZ SIMILAC
    2HW PRO 10
    3REX 10 OZ
    4AAA 10
    5BBB 2000
    6CCC 10 LB
    7DDD 2021
    8EE 12 KG
    9KK 11111
    10ZZ ABC FAC 11
    11RKW DD CC 12 OZ
    1212KJ 12 LBS.

    EXPECTED RESULTS

    SNO PROD_INFO PROD_VAL
    1SIMILAC20 OZ
    2HW PDR10
    3REX10 OZ
    4AAA10
    5BBB2000
    6CCC10 LB
    7DDD2021
    8EA12 KG
    9KK11111
    10AEC ABC ZZ11
    11RKW DD CC12 OZ
    1212KJ12 LBS.

    with

    as Prod

    (select 1 sno, "SIMILAC 20 OZ" prod_info of all the double union)

    Select 2, 'HW PDR 10' from dual union all

    Select 3, 'REX 10 OZ' from dual union all

    Select option 4, "AAA 10' from dual union all

    Select 5, "BBB 2000"of the dual union all

    Select 6, 'CCC 10 LBS' double union all

    Select 7, 'DDD 2021' from dual union all

    Select 8, 'EE 12 KG' from dual union all

    Select 9, 'KK 11111' Union double all the

    choose 10, "ZZ ABC FAC 11' from dual union all

    Select 11, 'CC DD RKW 12 OZ' from dual union all

    Order 12, '12KJ LB 12' double

    )

    Select sno,

    (prod_info regexp_substr(prod_info,'^((\d*|\w*)[^[:digit:]].*) \d',1,1,null,1).

    regexp_substr (prod_info,' prod_value (\d+.*)$',1,1,null,1))

    Prod

    SNO PROD_INFO PROD_VALUE
    1 SIMILAC 20 OZ
    2 HW PDR 10
    3 REX 10 OZ
    4 AAA 10
    5 BBB 2000
    6 CCC 10 LB
    7 DDD 2021
    8 EA 12 KG
    9 KK 11111
    10 AEC ABC ZZ 11
    11 RKW DD CC 12 OZ
    12 12KJ 12 LBS.

    Concerning

    Etbin

  • Splits the string into two columns

    Can someone please help me the following

    I want to divide into two columns URL and ID /cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107

    Result must be

    Temporary table
    < font color = "red" > URL < / police > < font color = 'blue' > ID < / make >

    < font color = "red" > /cfd/abc.html < / police > < font color = "blue" > 107 < / make >

    < font color = "red" > / night/aaa/page 1 < / police > < font color = "blue" > 107 < / make >

    < font color = "red" > / can/MLP/Page2 < / police > < font color = "blue" > 107 < / make >


    There can be N number of comma separated URLs, but there will be only 1 separate ID which is the vertical bar (|)

    Try this,

    SQL> WITH T
      2       AS (SELECT  '/cfd/abc.html,/night/aaa/Page1,/can/MLP/Page2|107 ' str FROM DUAL UNION ALL
      3           SELECT  '/cfd/def.html,/bbbb/bbbb/Page1,/lll/MLP/Page3|108 ' str FROM DUAL)
      4  SELECT REGEXP_SUBSTR ( str, '[^,|]+', 1, lvl) URL,
      5         REGEXP_SUBSTR ( str, '[^|]+', 1, 2) ID
      6    FROM T,
      7         (SELECT LEVEL lvl
      8            FROM (SELECT MAX (LENGTH (REGEXP_REPLACE ( str, '[^,]'))) mx FROM T)
      9          CONNECT BY LEVEL <= mx + 1)
     10   WHERE Lvl - 1 <= LENGTH (REGEXP_REPLACE ( str, '[^,]+'))
     11   order by id,lvl;
    
    URL                                                ID
    -------------------------------------------------- -------------------------------------------------
    /cfd/abc.html                                      107
    /night/aaa/Page1                                   107
    /can/MLP/Page2                                     107
    /cfd/def.html                                      108
    /bbbb/bbbb/Page1                                   108
    /lll/MLP/Page3                                     108
    
    6 rows selected.
    
    SQL> 
    

    G.

Maybe you are looking for