Divide the string into rows according to the space

I'm using Oracle 11.2.0.3.  I need a faster way to divide the organization names based on space as possible just using SQL.

with org as

(

Select 1 org_pk, org_nm 'ALL american, INC.' of any double union

Select org_pk 2, org_nm "COMPANY A.G" Union double all the

Select org_pk 3, org_nm "GROWTH FUND SPONSORS and SONS, Inc." of the double

)

Select * org;

Result, I need is

1. ALL THE

1 american

1, INC.

2 A.G

2 COMPANY

3. THE GROWTH

3 FUND

3 SPONSORS

3 and

3 WIRES,

3 INC.

Thank you very much.

You can use GROUP BY with LISTAGG or XMLAGG. And ordinalite allows to preserve order:

with org as)

Select 1 org_pk, org_nm 'ALL american, INC.' of any double union

Select 2 org_pk, 'A.G COMPANY' org_nm of all the double union

Select org_pk 3, org_nm "GROWTH FUND SPONSORS and SONS, Inc." of the double

)

Select org_pk,

x.org_nm,

x.o

org,.

XMLTable)

"ora: tokenize(.,"").

by the way ' ' | org_nm

columns

path of varchar2 (4000) to org_nm '.'.

o for the ordinalite

) x

where x.org_nm is not null

/

ORG_PK ORG_NM O
---------- ------------------------------ ----------
1 ALL                                     2
1 American 3
1 ,INC                                    5
2 A.G                                     2
2 COMPANY 4
3 GROWTH                                  2
3 FUND                                    3
3 4 SPONSORS
3 and                                     5
3 SONS,                                   6
3 INC.                                    7

11 selected lines.

SQL >

However, I would like to use SUBSTR/INSTR plain + CONNECT BY if the volumes are large or performance is important.

SY.

Tags: Database

Similar Questions

  • How to divide a string into an array of strings in separate tables

    Greetings,

    I have an array of strings which displays strings in a text file. I read each line of the text file and put it in an element of the matrix of the chain.

    Now, I'm trying to divide each string for each part of the chain, then put in a separate table. Each element in the chain is separated by a comma. I hit a brick wall at this point and would like to help please?

    The purpose of this is so that I have 4 tables that will be ready their item values and set variables based on these values until I went through all the elements in each array.

    Attached example.

    Also my VI is attached.

    Thanks in advance for your help.

    Then just use Index Array on 2D array provided.

  • Divide the value and insert into the table

    create table mytab (a tank (25), b Varchar2 (50), Varchar2 (100)) C;

    I have a string like

    myStr:'A$bggoy#qwewewee@A$Qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf @'

    I need to divide and insert into mytab

    That's what I tried

    declare p_str varchar2 (4000)

    Begin

    long l_str p_str default. '$';

    number of l_n;

    myTableType l_data: = myTabletype();

    Start

    loop

    l_n: = instr (l_str, ",");

    When the output (nvl(l_n,0) = 0);

    l_data.extend;

    l_data (l_data.count): =.

    LTRIM (rtrim (substr (l_str, 1, l_n - 1)));

    l_str: = substr (l_str, l_n + 1);

    -Connect mytab

    end loop;

    end;

    Shows below inf-s:

    describe the OBJ_SPLIT ;

    recreate

    CREATE OR REPLACE TYPE OBJ_SPLIT_table IS TABLE OF OBJ_SPLIT;

    to view the result of the compilation

    CREATE OR REPLACE Function Fn_get_split (P_str VARCHAR2)

    return OBJ_SPLIT_table

    PIPELINED is type t_ref_cursor IS REF CURSOR;

    rf_c t_ref_cursor;

    r_out_rec OBJ_SPLIT: = OBJ_SPLIT (null, null, null, null);

    Begin

    Open the rf_c for

    Select s,.

    REGEXP_SUBSTR (str, ' [^ $] +', 1, 1) s1,

    REGEXP_SUBSTR (str, ' [^ $#] +', 1, 2) s2,.

    REGEXP_SUBSTR (str, ' [^ $#] +' 1, 3) s3

    from (select s, REGEXP_SUBSTR (s, "[^ @] +', 1, rownum") str)

    (select s P_str of double)

    connect by instr (s, ' @', 1, level - 1) > 0)

    where str is not null;

    LOOP

    EXTRACTION rf_c

    IN

    r_out_rec. Str,

    r_out_rec. Delimter1,

    r_out_rec. Delimter2,

    r_out_rec. Delimter3;

    EXIT WHEN rf_c % NOTFOUND;

    PIPE ROW (r_out_rec);

    END LOOP;

    CLOSE Rf_c;

    end;

    and the result

    Select DELIMTER1, DELIMTER2, table DELIMTER3 (Fn_get_split('A$bggoy#qwewewee@A$qwe#zcxdf@A$po#xvcvxc@A$sdmy#sfdsdf@'));

    in SQLPLUS


    ----

    Ramin Hashimzade

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

  • divide a string in order to get the level of separate list.

    Hello

    I want to divide a string in order to get the level of separate list to connect this with a category table.
    The size of my list is dynamic and for this reason, I am unable to find a way to do it!

    This is an example of what I need to do:
    Consider the following list:
    Category                Category_ID
    Age                     1
    Less than 3 months      1.1
    Less than 9 months      1.2
    Less than 1 year        1.3
    Risk                    2
    Danger                  2.1
    High                    2.1.1
    medium                  2.1.2
    low                     2.1.3
    If I have a row that has category_id "2.1.3" I want to present values as:
    "Risk.Danger.Low"
    If I have a row that has category_id "1.1" I want to present values as:
    "Age.Less than 3 months"
    No clue as to what I should look for to achieve this?
    This will serve to produce a report. This report contains a few lines of a thousand and the categories will be around 100.


    Thank you
    Ricardo

    Hello

    I think this is a job for sys_connect_by_path...

    with p as
    (   select 'Age'             descr  ,'1' cat from dual union all
       select 'Less than 3 months'      ,'1.1' cat from dual UNION ALL
       select 'Less than 9 months'      ,'1.2' cat from dual union all
       select 'Less than 1 year'        ,'1.3' cat from dual union all
       select 'Risk'                    ,'2' cat from dual union all
       select 'Danger'                  ,'2.1' cat from dual union all
       select 'High'                    ,'2.1.1' cat from dual union all
       select 'medium'                  ,'2.1.2' cat from dual union all
       select 'low'                     ,'2.1.3' cat from dual
    )
    SELECT
        cat,
        LTRIM(SYS_CONNECT_BY_PATH(descr,'.'),'.') route
    FROM
        (
            SELECT
                descr,
                cat,
                SUBSTR(cat,1,INSTR(cat,'.',-1)-1) parent
            FROM
                p
        )
    START WITH
        parent IS NULL
    CONNECT BY
        PRIOR cat = parent
    /
    SQL> with p as
      2  (   select 'Age'             descr  ,'1' cat from dual union all
      3     select 'Less than 3 months'      ,'1.1' cat from dual UNION ALL
      4     select 'Less than 9 months'      ,'1.2' cat from dual union all
      5     select 'Less than 1 year'        ,'1.3' cat from dual union all
      6     select 'Risk'                    ,'2' cat from dual union all
      7     select 'Danger'                  ,'2.1' cat from dual union all
      8     select 'High'                    ,'2.1.1' cat from dual union all
      9     select 'medium'                  ,'2.1.2' cat from dual union all
     10     select 'low'                     ,'2.1.3' cat from dual
     11  )
     12  SELECT
     13      cat,
     14      LTRIM(SYS_CONNECT_BY_PATH(descr,'.'),'.') route
     15  FROM
     16      (
     17          SELECT
     18              descr,
     19              cat,
     20              SUBSTR(cat,1,INSTR(cat,'.',-1)-1) parent
     21          FROM
     22              p
     23      )
     24  START WITH
     25      parent IS NULL
     26  CONNECT BY
     27      PRIOR cat = parent
     28  /
    
    CAT   ROUTE
    ----- ------------------------------
    1     Age
    1.1   Age.Less than 3 months
    1.2   Age.Less than 9 months
    1.3   Age.Less than 1 year
    2     Risk
    2.1   Risk.Danger
    2.1.1 Risk.Danger.High
    2.1.2 Risk.Danger.medium
    2.1.3 Risk.Danger.low
    

    HTH

    David

    Published by: Bravid on Sep 2, 2011 14:50

  • 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

  • How to sort the rows according to the contents in cells

    Hello

    Is it possible to use a formula to sort the rows according to their cell contents? I will include a screenshot of my table. What I want to do is group together people based on where they live. I wish that all rows with an 'x' in a certain State of group. Who is? Thank you!

    Nevemind, I thought about it.

  • How to divide the C: drive into two partitions without a third-party program?

    Hello

    Is there a way to divide the C: drive into two partitions C: and D: on Windows XP without a third pary program?

    If anyone has an idea, please give some steps.

    Thank you.

    Assem

    Hey Assem,

    Once you have created a primary partition, it is not possible (for Windows XP) to divide the partition without using third-party software. You can see:http://support.microsoft.com/kb/309000 to create a new partition.

    I hope this helps...

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

  • Divide the line into several columns

    Hi all

    I have a question where I want to divide the line into multiple columns based on the delimiter ' |'.

    Staging of Table structure: People_STG, I have people in it.

    Create table People_STG(col1 varchar2(4000));


    Insert into People_STG(Emp_id|) User name | FirstName. LastName. JobTitle | hire_date | Location_id)


    SELECT REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 1) EMP_ID,
           REGEXP_SUBSTR ( COL1, '[^|]+', 1, 2) USERNAME,
           REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 3) FIRSTNAME,
           REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 4) LASTNAME,
           REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 5) JOBTITLE,
           REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 6) HIRE_DATE,
           REGEXP_SUBSTR ( COL1, '[^,|]+', 1, 7) LOCATION_ID
    FROM PEOPLE_STG
    WHERE length(regexp_replace(COL1, '[^|]', '')) = 14;
    

    But I am facing a problem here, as in some lines, function is null, but when I run the above query, it is not recognizing the empty element and inserting Hire_date values of function and location_id in Hire_date where function is null.

    for example: 1 | akash51 | Akaksh | C | 22/11/14 | 15

    Here the function is null, so when I run top to divide query it will insert 11/22/14 in the function column and 15 in Hire_Date.

    Please need help on this one.

    Oracle Version: 11.2 g

    Thanks in advance,

    Akash.

    There are different techniques to cope with this.  Is a simple...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select 1 | akash51 |) Akaksh | C | 22/11/14 | 15' as col1 of union double all the
    2 Select 2 | akash52 | Akaksh | C | Jobs jobs | 23/11/14 | 15' of the double
    3            )
    4  --
    5. end of test data
    6  --
    7 select trim (REGEXP_SUBSTR (COL1, ' [^, |] +', 1, 1)) EMP_ID,.
    8 toppings (REGEXP_SUBSTR (COL1, ' [^, |] +', 1, 2)) USERNAME,.
    9 garnish (REGEXP_SUBSTR (COL1, ' [^, |] +' 1, 3)) FIRSTNAME,
    10 pads (REGEXP_SUBSTR (COL1, ' [^, |] +' 1, 4)) LASTNAME,.
    11 garnish (REGEXP_SUBSTR (COL1, ' [^, |] +' 1, 5)) JOBTITLE,.
    12 pads (REGEXP_SUBSTR (COL1, ' [^, |] +', 1, 6)) HIRE_DATE,.
    13 garnish (REGEXP_SUBSTR (COL1, ' [^, |] +' 1, 7)) location_id
    14 * from (select replace (col1, ' |)) ',' | as col1 of t)
    SQL > /.

    EMP_ID USERNAME FIRSTNAME LASTNAME, JOBTITLE HIRE_DATE LOCATION_I
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    1 akash51 Akaksh C 22/11/14 15
    2 akash52 Akaksh C Job 23/11/14 15

  • How to divide the Source file into smaller files without export?

    Hi all

    I am a beginner with PPro CS4 and video editing in general. I did a lot of research on Google and the search of these forums for an answer to this question, but I have not found a clear answer. Here's my problem:

    I have many hours of HDV video in recent years with a Canon HV30. This sequence is on dozens of DV tape cassettes. I want to capture most of it on the disk.

    When I capture a band on the disc, I get a single large mpeg4 file. (Body captures all HDV films in mpeg4). "select Scene" does not work with the HV30, so my only way to make a small capture files would be set In/Out points with batch capture. But that would mean hours of fast forward and back with VCR type controls on the camera for the revision of all bands and points. I thought it might be more QUICK to capture everything simply a whole band at once, and THEN examine the band captured the Organization (he is much faster using the Purifier), and by dividing the file into smaller files within the Organization, thus avoiding mechanical advance and rewind on the camera itself.

    But the only way I can find for it seems to imply EXPORT clips. Am I wrong to think that the export of a clip to a new file involves a degradation of the original mpeg4 source file? Or there will be no loss of quality if I simply export to mpeg4 format?

    It seems that there should be an easy way to simply divide the initial capture in small source files for editing later, without putting the images through a new generation of (exporting) treatment, which could result in a loss of quality. Or I'm wrong about this?

    (CS4 Master Suite, i7 3630 k, 16 GB RAM, C: 256 GB SSD, 1 t D:, E: 1 t F3 setpoint setpoint F3)

    HDV film is mpeg2 (which is a number). CS4 is not scene detect you will need to use HDV split for this.

    http://strony.aster.pl/paviko/hdvsplit.htm.

    You can run your files already captured by hdv split and it will cut the file into clips and you leave.

  • TB has worked fine until yesterday when I needed to send a message to more than 100. I divided the AddressBook into pieces and sent about 50 when TT502 came.

    I use TB 31.7.0, PC Windows 7. Had no problems until now. I divided the 100 addresses in groups of about 20 and sent to 3 groups. The 4th was wrong and I got the message: "too many recipients, TT502. I cut down the number of addresses, but the problem persists. I can't send all messages now, even to a single recipient. So I have a problem that does not reset when tuberculosis is turned off and restarted. Incoming is fine but I can't answer. Any ideas?

    Looks like you reach the limit of the sending of your provider. Of course sending for 1 person isn't too unless your provider has a hourly or daily limit and cut you.
    Given that the error has an associated server code the error came from your server vendors. Thunderbird would have nothing to do with it.

  • How to divide the form into 2

    I created an interactive report and a form. By clicking on the button Edit in the report, taking me in a form with all the details of that particular line. Now I want to divide the elements in 2 forms, edit details, and update them at the same time. Pointers or suggestions is appreciated

    Published by: user739459 on August 17, 2011 12:59

    If you want to split because of the logical separation between the elements, you can create a new region and move some items to that. If you want to keep certain items on a single page and some on the other hand, you can copy the page and remove the items is not necessary two pages (except primary key point). Now, create a button on the first page to open the second page, passing the primary key and do the same on page two.

    Lavenu
    MaxApex accommodation
    http://www.maxapex.com

  • divide the text in paragraph format

    I came across a scenario where I have to pull the value of database table column whose datatype is clob.

    This column contains descriptive information. Here I have to publish data in the format of paragraph to comply with the conditions

    No line exceed 80 characters maximum, no words are cut between the two to start the new line.

    Example of

    If I limit myself is by line 4 char

    then separated from the text abcd ef ghi jkl mn opqr

    Power required is

    ABCD

    EF

    IGS

    JKL

    MN

    opqr

    In addition, if solutions comes from regexp that guide/document/link is recommended for this.

    Some examples of my library of examples:

    SQL > ed
    A written file afiedt.buf

    1 with t as (select q '[this is a very long piece of text that need packaging word at my limit of 50 character width specified for it to appear on different lines, when I select it.]' as double txt)
    2  --
    3. Select rn, txt, length (txt) ln
    4 of)
    5 Select rownum: nurse
    6, trim (regexp_substr (txt,'.)) {} 1.50} (| $) ', 1, rownum)) as txt
    7 t
    8. connect by rownum<=>
    9       )
    10 * where txt is not null
    SQL > /.

    RN TXT                                                                                                  LN
    ---------- ---------------------------------------------------------------------------------------------------- ----------
    1. This is a very long piece of text that will be 46
    2 who needs my 50 50 specified character word wrapping
    3 limit of width so that it appears on different lines 49
    4 when I select it.                                                                                    17

    SQL >

    Back to the line with left and right justification...

    declare
    number of v_linesize: = 50;
    cursor cur_data is
    with t as (select 1 as id, q'[for several days after leaving Nantucket, nothing above hatches was seen of Captain Ahab.) The companions of the other statement regularly to watches, and for punishment that could be seen on the contrary, they seemed to be the only commanders of the ship; only, they sometimes emitted from the cabin with orders so sudden and peremptory, after all, it's clear that they have command but the vicarious. [Yes, their supreme Lord and dictator was there, although far invisible for the eyes not allowed into retirement now sacred cabin.] "as txt of the union double all the


    q 2, select "[whenever I mounted on the bridge from my watch below, I was watching instantly back to mark if any strange face was visible; for my first wave of malaise affecting the unknown captain, now in the solitude of the sea, became almost a disturbance. It was strangely sometimes accentuated by diabolical inconsistencies of the Elijah ragged uninvitedly recurring for me, with a subtle energy, that I couldn't have conceived before. But bad I couldn't resist, as much as in other States of mind, I was almost ready to smile at the solemn whimsicalities of this strange Prophet of the docks. But whatever apprehension or illness - to call it that - that I felt, yet whenever I came to look around in the ship, apparently against all the warrantry to cherish these emotions. For good the harpooneers, with the great body of the crew, were a set much more barbaric, Pagan and eclectic as any of the merchant-ship companies tame my previous experiences had acquainted me, always I attributed this - and - attributed rightly wild ferocious nature of this Scandinavian vocation oneness in which I had embarked so abandonedly. But it is especially the aspect of the three Directors of the ship, comrades, that was calculated more force to dispel these fears colourless and induce the confidence and good humor to every presentation of the trip. Three better, more likely to sea-officers and men, each in its different way, is easily found, and they were all of them American. a Nantucketer, a Vineyarder, a man of Cape. Now it's Christmas when the ship fired on its port, for a space we had Polar weather, bite well always run away from him to the South; and all degrees and minutes of latitude which we sailed, gradually leaving this winter ruthless and all its intolerable time behind us. It was one of those who are less down, but still gray and dark enough the morning of the transition, when with a good wind of the ship was rushing into the water with some sort of revenge of fast bouncing and melancholy, which as I rode on the bridge to the morning call attention, so as soon as I brought my gaze towards the taffrail , foreboding shivers ran over me. Reality musi apprehension; Captain Ahab asked on her forecastle. (End]' double)
    SELECT id, txt
    t;
    cursor cur_wordwrap (p_txt in varchar2) is
    Select rn, txt
    de)
    Select rownum: nurse
    , trim (regexp_substr (p_txt,'.)) {} 1,'|| {v_linesize |'} (| $) ((', 1, rownum)) as txt
    of the double
    connect by rownum<=>
    )
    where txt is not null
    order by rn;
    v_txt varchar2 (2000);
    number of v_loops;
    Start
    for d in cur_data
    loop
    dbms_output.put_line ('ID: ' | d.ID);
    dbms_output.put_line('===');
    for w in cur_wordwrap (d.txt)
    loop
    v_txt: = w.txt;
    loop
    When the output length (v_txt) = v_linesize or instr (v_txt,' ') = 0;
    because me in 1.v_linesize - length (v_txt)
    loop
    v_txt: = regexp_replace (v_txt,'([^]) ',' \1 ', 1, i);
    end loop;
    end loop;
    dbms_output.put_line (v_txt);
    end loop;
    dbms_output.put_line ('- ooo-');
    end loop;
    end;
    /

    ID: 1
    ===========
    For several days after leaving Nantucket, nothing
    above hatches was seen of Captain Ahab. The companions of
    the other noted regularly in watches, and
    for punishment that could be seen on the contrary, they
    seem to be the only commanders of the ship; only
    they sometimes come from the cabin with orders
    It was so sudden and peremptory, after all
    plain, they have command but the vicarious. Yes, their
    supreme Lord and dictator was there, although
    so far unseen by the eyes not allowed to
    Enter the now sacred retreat of the
    cabin.
    -oOo-
    ID: 2
    ===========
    Whenever I climbed onto the bridge from my watches
    below, I was watching instantly back to mark as appropriate
    strange face were visible;  for my first wave
    worry about touching the unknown now in Captain
    the solitude of the sea, has become almost a
    disturbance.  It was strangely raised at
    time by the Elijah of diabolical rags
    inconsistencies recurring uninvitedly for me, with a
    I could not have conceived before the subtle energy
    of.  But bad could I resist them, much as in
    other moods, I was almost ready to smile at the
    solemn whimsicalities of this strange Prophet
    docks.   But whatever it is of
    reluctance or discomfort - to call it so-
    that I felt, yet whenever I came to look around
    in the ship, apparently against all the warrantry to
    cherish these emotions. For the harpooneers,
    with the great body of the crew, have been further
    Barbarian game, Pagan and eclectic than any of
    the ship merchant companies tame that my previous
    experiences had met me with, still, I
    attributed to this - and rightly-attributed to the
    fierce nature uniqueness of this savage
    Scandinavian vocation in which I had so
    abandonedly embarked.  But it was above all the
    aspect of the three Directors of the ship,
    peer, who has been calculated more forcibly to
    allay these fears colourless and induce
    confidence and good humor to every presentation
    of the trip.   Three better, more likely
    Sea-officers and soldiers, each to its own different
    so easily is not found, and they were
    each of them American;  a Nantucketer, one
    Vineyarder, a man of Cape. Now, it's Christmas
    When the ship pulled on its port, once
    space, we had to bite Polar weather, although all the
    times in a row away from him to the South; and surroundings
    each degree and minute of latitude we
    departed, leaving little by little this merciless winter.
    and all its intolerable time behind us. He has been
    one of those who are less down, but still gray and
    pretty dark transition, when morning
    with a fair wind, the ship was quickly through the
    the water with a kind of vengeance of leaping and
    speed of melancholy, that as I rode him on the bridge
    the call of the morning watch, so little time as I
    upgrade my gaze to the taffrail,
    feeling chill ran over me. Reality musi
    apprehension;   Captain Ahab stood at sound
    Gaillard.                                  End
    -oOo-

    PL/SQL procedure successfully completed.

    SQL >

    With the help of simple PL/SQL... for example

    declare
    v_str varchar2 (32767): = ' the role of trainer to support Oracle is based within the Department of learning & development, development of human resources at the headquarters of the Oracle.

    The incumbent of the post will have to identify training needs, develop, design, deliver and evaluate programs and technique of Oracle classes. As part of the training process, the incumbent will have to monitor, assess and validate students in accordance with the standards of the Organization and conduct of training evaluation in line with the assessment of the organization model.

    See the following document: http://www.google.co.uk/webhp?hl=en&tab=ww#hl=en&output=search&sclient=psy-ab&q=oracle+support+forum&oq=oracle+support+forum&gs_l=hp.3..0j0i5i30j0i8i30l2.887.887.0.1481.1.1.0.0.0.0.112.112.0j1.1.0.les%3B..0.0...1c.1j2.Q7xkCE4VDHw&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=a15916df00f85ecd&biw=1417&bih=964

    The incumbent of the position must also be ready to undertake relevant training and development that may be provided outside.';
    v_output varchar2 (32767).
    v_line varchar2 (500);
     
    / * Table to hold the words * /.


    type t_array is the table of index varchar2 (500) by pls_integer;
    v_array t_array;
    number of v_linesize: = 65;
    Start
    v_str: = replace (v_str, Chr (10), ' ' | 10;)
    -Use SQL to split the string into words and store in table
    Select regexp_substr (v_str, "[^] +', 1, level")
    bulk collect into v_array
    of the double
    connect regexp_substr (v_str, "[^] +', 1, level") is not null;
     
    -loops through every word in the table
    because me in 1... v_array. Count
    loop
    If v_array (i) = Chr (10) then
    v_output: = v_output | v_line | Chr (10);
    v_line: = ";
    on the other
    If length(v_line||) e '|| v_array (i)) > v_linesize then
    -added the word exceeed the limit of the line would then add the current line at the exit with a line break and start a new line of text with the word
    v_output: = v_output | v_line | Chr (10);
    While length (v_array (i)) > v_linesize
    loop
    -We'll get here if the word is more than 65 characters
    v_output: = v_output | substr (v_array (i), 1, v_linesize). Chr (10); -Add the first 65 characters of the word to the output
    v_array (i): = substr (v_array (i), v_linesize + 1);                  -remove the first 65 characters of the word and check again.
    end loop;
    v_line: = v_array (i); -Add the word, or remaining part of the word (if it exceeded the 65 characters) to the line.
    on the other
    v_line: = trim(v_line||) e '|| v_array (i)); -cut the space for the first word in the line
    end if;
    end if;
    end loop;
    -make sure that the last line, we have implemented get added.
    v_output: = v_output | v_line;
     
    -display the result
    dbms_output.put_line (v_output);
    end;

    The role of trainer to support Oracle is based in learning &
    Development, human resources development department at Oracle
    Central Administration.

    The incumbent will identify training needs,
    develop, design, deliver and evaluate techniques course Oracle
    and programs. The process of training the position
    they will have to monitor, assess and validate students in
    compliance with the standards of the Organization and the assessment of the conduct of
    training in line with the assessment of the organization model.

    See the following document:
    http://www.Google.co.UK/webhp?hl=en&tab=WW#hl=en&output=search&SC
    bind = shrink - ab & q = oracle + support + forum & oq = oracle + support + forum & gs_l =
    HP.3... 0j0i5i30j0i8i30l2.887.887.0.1481.1.1.0.0.0.0.112.112.0J1.1.
    0.Les%3B... 0.0... 1 c .1j2. Pbx & Q7xkCE4VDHw = 1 & bav = we. 2, or.r_gc.r_pw.r_
    QF. & fp = a15916df00f85ecd & biw = 1417 & bih = 964

    The incumbent of the position must also be ready to undertake the
    training and development that may be provided outside.

Maybe you are looking for

  • Imports lost in iMovie

    I use iMovie 10.1.2 on a mac mini server. I recently imported a wedding video to iMovie. I've skimmed through all the clips to ensure that they were imported to the library. I left it running and had to leave for a while. When I came back, there was

  • I can't seem to be able to watch videos on any website more on firefox

    I checked to see if all of my add has were aware that they are. Firefox is updated.

  • Why so hot?

    Hey. Can someone explain to me, why my computer becomes so hot watching Netflix. About 5-6000 RPM! With our national, or any other, television channel, no problem. Bad code?

  • Entire scan of long integer modifier

    Hello I'm looking for likely the format of a variable of integer type For example: int nb; NB = 1; Change the content of the variable nb 1 at 000001

  • W510 Quadro FX 880M and Linux

    Hi all I am running Debian Squeeze 64 bit on this machine - 'more' material can talk about linux, or vice versa. I am, however, having bad to find a free driver / non-adapted to work with the above map. It would seem that this card is too 'new' at th