get the length of each string in a column

Hi all

Is there a way to get the length of each string in a column:

for example:

If the table contains lines like below:

Select 'test test1 test31' col1 of double

Union of all the

Select 'sectest1 sectest234' double col1

The output should be as below:

col1

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

4 5 6

8 10

That is to say get the count of each separated from the chain of space in a column. Is this possible using regexpr_substr?

Thanks in advance.

Roy.

Try the below

SELECT LISTAGG(val1,' ') IN ONE GROUP)

New_val ORDER BY lvl)

Of

(SELECT LENGTH (REGEXP_SUBSTR (col1,'[^] +', 1, LEVEL)) val1,)

RN,

LEVEL lvl

Of

(SELECT col1,

ROWNUM rn

Of

(SELECT 'test test1 test31' col1 OF double)

UNION ALL

SELECT 'sectest1 sectest234' double col1

)

)

CONNECT BY LEVEL<= regexp_count(col1,'="">

AND PRIOR rn = rn

AND PRIOR DBMS_RANDOM. VALUE IS NOT NULL

)

GROUP BY rn;

OUTPUT:-

=======

col1

----

4 5 6

8 10

Thank you

Ann

Tags: Database

Similar Questions

  • How get the text of each paragraph when a textStyleRange is made of texts to multiple paragraphs

    Hello

    Always on my account findText. The result is sometimes as a textStyleRange which contains the texts of multiple paragraphs. What is the best (and easy) way to get the text of each paragraph individually?

    Example: The result of an italic findText with the following extract gives me "saectur quatur? " " Ipsapidunte our" as a unique textStyleRange (correct) but I want to get the text of each paragraph.

    Is there a way to force the findText in the paragraphs and not those of them and if not, how to cut the textStyleRange in 2 texts?

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

    Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus repratur molorio enis modi sumquibus nostemquam and volorum facidunti nonseditati re a dolut dolorest ab idipitem saectur quatur?

    Our Ipsapidunte and eumquosame derepre id ulparch iliquae offic tem faccusd aecaborrum, sequi aut doloreperi quaectem eatem faces very quam, con nullaccus nostemquam repratur molorio enis modi sumquibus and re volorum facidunti nonseditati a saectur dolut dolorest ab idipitem quatur?

    There are two solutions:

    (1) you could be formatted every paragraph with formatting marks that you know doesn't exist anywhere else. In this way, each textStyleRange is guaranteed to end at the end of the paragraph.

    (2) you can access the entire first paragraph: myTextStyleRange.paragraphs [0]. I have not tested, but no doubt it works. You could also do a loop: paraLength = myTextStyleRange.paragraphs.length; for (i = 0; i< paralength;="" i++);="" mypara="myTextStyleRange.paragraphs[i];}">

  • Microsoft Movie Maker - cannot change the length of each clip.

    Cannot change the length of each clip on Microsoft Movie Maker.

    I clicked on 'tools', then 'options' in Microsoft Movie Maker after importing my media and organize my clips as the way I would like it. When I then click on the "Advanced" tab, image duration shows only 5 seconds with the transition period only 1.25 seconds, which is the default setting and that is also what I want. However, when I play my project in Movie Maker, it accelerates through each clip. I also noticed that when I press the title of 'Clip' in my headings at the top left and then click on 'Properties', the duration of each clip shows that only 00:02 seconds. Which is why my speed clips too quickly.

    I would have thought that setting my time of duration in the Tools section would then set in the Clips section, but this is obniously does not. I don't understand why everyone would show differently and wonder if you can help me to slow down the speed that my movie is playing.

    Thank you

    Cannot change the length of each clip on Microsoft Movie Maker.

    I clicked on 'tools', then 'options' in Microsoft Movie Maker after importing my media and organize my clips as the way I would like it. When I then click on the "Advanced" tab, image duration shows only 5 seconds with the transition period only 1.25 seconds, which is the default setting and that is also what I want. However, when I play my project in Movie Maker, it accelerates through each clip. I also noticed that when I press the title of 'Clip' in my headings at the top left and then click on 'Properties', the duration of each clip shows that only 00:02 seconds. Which is why my speed clips too quickly.

    I would have thought that setting my time of duration in the Tools section would then set in the Clips section, but this is obniously does not. I don't understand why everyone would show differently and wonder if you can help me to slow down the speed that my movie is playing.

    Thank you

    ================================
    The change of setting to: Tools / Options /.
    Advanced... tab applies only to the added clips
    to the timeline * after * you change the setting.

    If you switch to view "Storyboard" and select
    all of the clips as a batch (select one and the type...
    CTRL + A)... you can add the 'Speed Up, Double.
    or "Slow down, half" effect of changing the
    duration. Simply select all clips / right click
    the effect on the menu... Choose...
    Add to storyboard table.

    'Speed Up, Double' cuts the duration of half.

    "Slow Down, half ' double life.

    These effects can be added up to six times.

    If you need finer adjustment...
    the info may be useful:

    You can change the duration for each clip
    manually. Move your pointer autour the
    edge of an element until you see a double red
    arrow. Now, drag the double red arrow...
    you will see if show a ToolTip displays the duration
    train to change.

    Or... just to redo the project after changing
    the long-term: Tools / Options / Advanced
    tab.
    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • How to get the length of the (playbook) video?

    How to get the length of the video?

    I need a maximum value for use with mmr_seek() or mmrenderer_event_get_position().

    If you like in the file system on your PlayBook, you will see this:

    / pps/services/multimedia/converter/context.

    There should be a directory with the name of the conext you use with mmrender. Under this directory the file called metadata. For an mp3 player, I see this:

    [n]@metadata
    md_title_album::Sublime
    md_title_artist::Sublime
    md_title_bitrate::192000
    md_title_comment::
    md_title_duration::290812
    md_title_genre::Alternative
    md_title_mediatype::4
    md_title_name::Get Ready
    md_title_samplerate::44100
    md_title_track::14
    url::file:///accounts/1000/shared/music/Media Sync/Sublime/Sublime/Sublime - 1996 - Sublime - 14 - Get Ready.mp3
    

    You could write a simple parser to get the data you need.

  • Is there a function to adjust the length of a string to 8 multiple bytes?

    Hello

    I have a function to encrypt a password.

    FUNCTION encodeit (p_name IN VARCHAR2, p_password IN VARCHAR2) RETURN VARCHAR2
       IS
          l_password   VARCHAR2 (4000);
          l_salt       VARCHAR2 (4000) := 'hdjikndbbhitasuihfnnkqyhiplwmneuyndnloidj';
       BEGIN
          l_password :=
             UTL_RAW.cast_to_raw (
                DBMS_OBFUSCATION_TOOLKIT.md5 (
                   input_string => p_password ||
                                   SUBSTR (l_salt, 10, 13)||
                                   LOWER (p_name)||
                                   SUBSTR (l_salt, 4, 10)));
          RETURN l_password;
       END;
    

    I want to decrypt the password to send to users when they forget it.  I wrote this function:

    FUNCTION decodeit (p_name IN VARCHAR2, p_password in VARCHAR2) RETURN VARCHAR2 IS
        l_salt       VARCHAR2 (4000) := 'hdjikndbbhitasuihfnnkqyhiplwmneuyndnloidj';
        BEGIN
          RETURN DBMS_OBFUSCATION_TOOLKIT.desdecrypt(input_string =>  p_password ||
                                                                      SUBSTR (l_salt, 10, 13)||
                                                                      LOWER (p_name)||
                                                                      SUBSTR (l_salt, 4, 10),
                                                     key_string   => l_salt) ;
        END;
    

    The problem is that the DBMS_OBFUSCATION_TOOLKIT.desdecrypt function needs a multiple of the input string of 8 bytes. And p_name and p_password are not of fixed length. Is there a function to adjust the length of a string to 8 multiple bytes?

    Best regards.

    They used to work - could be almost ten years (I think version 9 - not tested yet)

    As you can see, you can 'encode' the number of characters, padded in order to set the right length of the decrypted string


    create or replace FUNCTION ' CRYPTIN "(p_str in varchar2) return varchar2 as". "

    l_data VARCHAR2 (255);

    function pad_DES (p_string in varchar2) return varchar2 is

    -platelets p_string with pad_chr containing the number of characters padded (1 to 8)

    -make the string length a multiple of 8 as required by decipher

    pad_length pls_integer;

    pad_char char: = chr (0);

    pad_chars varchar2 (8);

    Start

    pad_length: = 8 - mod (length (p_string), 8);

    pad_chars: = chr (pad_length);

    Return concat (p_string, rpad (pad_chars, pad_length, pad_chars));

    end;

    Start

    l_data: = pad_DES (p_str);

    dbms_obfuscation_toolkit. Decrypt (input_string-online l_data, key_string => 'MagicKey' encrypted_string-online l_data);

    return UTL_RAW. CAST_TO_RAW (l_data);

    end;

    create or replace FUNCTION ' CRYPTOUT "(p_str in varchar2) return varchar2 as". "

    l_data VARCHAR2 (255);

    function unpad_DES (p_string in varchar2) return varchar2 is

    -Removes from p_string upholstered characters (1 to 8)

    pad_length pls_integer;

    Start

    pad_length: = length (p_string);

    pad_length: = pad_length - ascii (substr(p_string,pad_length,1));

    Return substr(p_string,1,pad_length);

    end;

    Start

    l_data: = p_str;

    dbms_obfuscation_toolkit. DESDecrypt (input_string-online l_data, key_string => 'MagicKey', decrypted_string-online l_data);

    Return unpad_DES (l_data);

    end;

    Concerning

    Etbin

  • Is it possible to get the length to swipe distance?

    Hello

    Is it possible to get the length to swipe distance?

    I use Actionscript3 in AnimateCC.

    And I use the event: TransformGestureEven to drag the event.

    (x distance only)

    Oh... I don't care?

    with touchpoint, you can, but I'm not using a gestureevent for this.  If you must use sign language events in other parts of your application, you can try mousedown and mouseup.

  • Get the Parent for each record in the child

    Dear Experts,

    I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.

    Table: relationship

    Parent of the child

    102 101

    103 102

    104 103

    106 105

    107 106

    109 108

    110 109

    Output:

    Expected child

    102 101

    103 102; 101

    104 103, 102, 101

    106 105

    107 106; 105

    109 108

    110 109

    Thank you very much

    Hello

    MU * 443499 * TR wrote:

    Dear Experts,

    I have a table that contains the parent and child information. I need to make a request to get the parents of each book of the child table. I tried to write the query but does not get the expected results. Please help me.

    Table: relationship

    Parent of the child

    102 101

    103 102

    104 103

    106 105

    107 106

    109 108

    110 109

    Output:

    Expected child

    102 101

    103 102; 101

    104 103, 102, 101

    106 105

    107 106; 105

    109 108

    110 109

    Thank you very much

    Why do you want to

    Expected child

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

    110 109

    Instead of

    Expected child

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

    110 109; 108

    ?

    You may want something like this:

    CONNECT_BY_ROOT SELECT AS children

    SYS_CONNECT_BY_PATH (parent, ';')  AS expected_output

    FROM table_x

    WHERE CONNECT_BY_ISLEAF = 1

    CONNECT BY child = parent PRIOR

    ;

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

  • Somehow I can get the length of a segment of the timeline using only entry points and somehow like in FCP?

    Users of Adobe Premiere:

    Somehow I can get the length of a segment of the timeline using only entry points and somehow like in FCP?


    I want to get the exact length of timecode for some segments only, not the entire timeline. Can not know how to do this.

    If you set the entry points and in the program monitor, is indicated to the right:

  • get the length of a track/curve?

    Hello.

    As part of my business I'm looking for a way to get the length of a plotter-line in mm.

    I saw that there are plug-ins via forums but positions date of 10 years.

    So I think he has equipment something pour give us this information since the multiple version of adobe for 10 years?

    Could you me filled in on this topic?

    Thank you

    Jacob Bugge:


    the translation is not really understandable, but I understand through your last link is good and it works.
    Thank you

  • Get the length and width of a rectangle

    I use sdo_sam.tiiled_bins in rectangles of bursting into different sections. I need to divide the rectangle along the x axis depending on if there is longer or wider. I checked the documentation and I couldn't find a way to get the length and width of a rectangle encompassing minimum. Is there any built-in feature to get the length and width of a rectangle or do I have to create my own? Database is 11 GR 2.

    Thank you
    Rob

    Rob,

    You can use SDO_GEOM. SDO_MIN_MBR_ORDINATE and SDO_GEOM. SDO_MAX_MBR_ORDINATE to calculate the length and width of a mbr.

    References:

    [SDO_GEOM. SDO_MIN_MBR_ORDINATE | http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_objgeom.htm#i866250]

    [SDO_GEOM. SDO_MAX_MBR_ORDINATE | http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_objgeom.htm#i866249]

    Kind regards
    Noel

  • How to get the length and sub lymph nodes.

    Hello

    find the script below.

    < List1 >

    < list >

    < List1 >

    < List1 >

    < List1 >

    < / list >

    < list >

    < List2 >

    < List2 >

    < List2 >

    < / list >

    --

    --

    -

    -

    -

    -< / list1 >

    Here the tag list will be growing based on the I / p. Now what I want is to know how to get the length of the tag < list >.

    To implement the above I used the code below

    var number = xfa.record.List1.List [0].nodes.length; (Does not work)

    But if var account = xfa.record.List1.nodes.length; (work)

    and also I want to delete a tag inside the < List > tag. How?

    Very Urgent.

    Thanks in advance.

    Yes, you need to use the name instead of the value to get the tag name...

    xfa.datsets.data.Root.nodes.item (0) .name

    Thank you

    Srini

  • How to get the length of apex_item in javascript?

    Hi all

    I'm having a tabular report using apex_item, I want to know how can I get the length of the element in javascript? as we do in pl/sql using apex_application.g_f01.count ().

    and one more thing, when I go to some page, the page tab is disabled do, what should I do to allow tab always know if I am on this page or any other page.

    Thank you
    Tauceef

    Hello

    just refer javascript on this link

    http://Apex.Oracle.com/pls/OTN/f?p=31517:213:2041230563219134

    It will help you solve your problem

    Kind regards

    Kitenge

  • multiple-join: get the value of each participant

    In the multiple join, the studio and independent do not allow to define the inside interactive activity can be suspended. Is there another way to put it can be suspended?

    If the instance has 5 copies and each is sent to different participants, how to get the value of each user?

    Quantity of copies to wait to release the default value is 0. What it means?

    Forget not the only multiple makes copies. The main forum is a copy, it remains as it was before the Multiple. And the join does not know how to merge magically all the data of each copy in the main forum. It takes that code as well in the join. Otherwise, your main instance will remain intact.

    If I understand your example, you're not updating the values of the instance variables of your main instance, only copies.

    If you want to get a number that corresponds to the sum of all values sent by all participants in the Multiple, you must make the amount inside the join:

    This.var2 = this.var2 + copy.var1;
    (don't forget to initialize var2 in the primary instance)

    In this way, whenever a copy arrives at the join, var2 is added the value typed in the participant of this particular copy.

    I hope that helps!

  • How to get the length of the string a vm?

    Hello

    I'm trying to automate some consolidation of virtual machines and would like to add script. I have over 800 virtual machines manually would not work.

    I would like to

    $allVApps = get-CIVApp

    foreach ($CIVm to ($allVApps |)) Get - CIVM)) {}

    find the number of channels and if greater than 8 consolidate them.

    }

    Someone has this practice? or something else?

    I'm in a cloud environment vSphere 5.5, installed latest powercli.

    Thank you

    Don't know why this does not work for others, but what I posted before work for me.  Here is a more complete version of how get the those of VAPP VM.  There are no doubt more direct ways, but that how I made it so far:

    1. get the VAPP

    $vApp = get-CIvApp-name 'Test-VAPP.

    2. get the VMS of vApp

    $VMs = $vApps.ExtensionData.Children.vm

    3. get the ones for the VM first in the list of $VMs:

    $VMs [0]. VCloudExtension.any.VirtualDisksMaxChainLength

    This last command returns 18 for me which is the "Length of the string" value in the properties of the Virtual Machine to the virtual machine in the vCD UI.

    I hope this helps.

  • Get the bind variables name string SQL or the cursor

    Hello

    Is there way to get of the bind variables name string SQL or the cursor?

    Example of
    DECLARE
      l_sql VARCHAR2(2000);
      desctab DBMS_SQL.DESC_TAB;
      curid   PLS_INTEGER;
    BEGIN
    
      l_sql := 'SELECT * FROM emp WHERE mgr = :X and deptno = :Y';
    
      curid := dbms_sql.open_cursor;
      dbms_sql.parse(curid, l_sql, dbms_sql.NATIVE);
      ....
    END;
    What I mean with the SQL string:
    I love to get using some functions from above code variable l_sql all the bind variable.
    In this case the function should return array where is for example: X and: Y

    Back to bind the cursor variable names, I mean same but rather string I pass number of cursor.

    Y at - it sucks ready function or some may share a code customized for this purpose?

    Thanks

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Regards,

    Published by: jarola December 19, 2011 02:44

    I found there are wwv_flow_utilities.get_binds of the function not documented in APEX packages that do what I want.
    Usage example
    set serveroutput on
    DECLARE
      binds DBMS_SQL.varchar2_table;
    BEGIN
      binds := wwv_flow_utilities.get_binds('select :P1_TEST from dual');
      FOR i IN 1 .. binds.count
      LOOP
        dbms_output.put_line(binds(i));
      END LOOP;
    END;
    /
    
    anonymous block completed
    :P1_TEST
    But I would not use these functions without papers as those who can change or there is no future versions APEX.
    Is there a documented function or the custom function that do the same thing as wwv_flow_utilities.get_binds?

    Some old basic example code of my friends. Also the media getting the bind variable of PL/SQL code blocks anon.

    SQL> create or replace function GetBindVariables( statement varchar2 ) return TStrings is
      2          --// bind variables names are terminated by one the following special chars
      3          SPECIAL_CHAR    constant TStrings := TStrings(' ',')','+','-','>','<','*',',','=',';',CHR(10),CHR(13));
      4
      5          --// max size of a bind var name
      6          MAX_VARSIZE     constant integer := 100;
      7
      8          pos     integer;
      9          pos1    integer;
     10          occur   integer;
     11          varName varchar2(100);
     12          varList TStrings;
     13  begin
     14          varList := new TStrings();
     15
     16          --// looking for the 1st occurance of a bind variable
     17          occur := 1;
     18
     19          loop
     20                  pos := InStr( statement, ':', 1, occur );
     21                  exit when pos = 0;
     22
     23                  varName := SubStr( statement, pos, 100 );
     24
     25                  --// find the terminating char trailing the
     26                  --// bind variable name
     27                  pos1 := Length( varName );
     28                  for i in 1..SPECIAL_CHAR.Count
     29                  loop
     30                          pos := InStr( varName, SPECIAL_CHAR(i) ) - 1;
     31                          if (pos > 0) and (pos < pos1) then
     32                                  pos1 := pos;
     33                          end if;
     34                  end loop;
     35
     36                  --// extract the actual bind var name (without
     37                  --// colon char prefix)
     38                  varName := SubStr( varName, 2, pos1-1 );
     39
     40                  --// maintain a unique list of var names
     41                  if not varName member of varList then
     42                          varList.Extend(1);
     43                          varList( varList.Count ) := varName;
     44                  end if;
     45
     46                  --// look for the next occurance
     47                  occur := occur + 1;
     48          end loop;
     49
     50          return( varList );
     51  end;
     52  /
    
    Function created.
    
    SQL>
    SQL> select
      2          column_value as BIND_VAR
      3  from TABLE(
      4          GetBindVariables('select * from foo where col=:BIND1 and day = to_date(:B2,''yyyy/mm/dd'')')
      5  );
    
    BIND_VAR
    ------------------------------
    BIND1
    B2
    
    SQL> 
    

    PS. just realize this code is case-sensitive, while variable bind is not. Should throw a upper() or lower() by adding the name of the var to the list - never really a problem for me because I'm pretty tense when it use cases correctly in the code. ;-)

    Published by: Billy Verreynne, December 19, 2011 06:19

Maybe you are looking for

  • entry of the file type, how to filter only .csv

    use firefox 21.0use < input type = "file" accept = "xxx" / > How to filter only .csv (* not include all the files) when scour dialogue I try to use .CSV (view all) text/csv (.csv and show all files) application/csv (view all) text /-comma - separated

  • C50-B-15Z satellite does not recognize discs when inserted

    Toshiba Satellite C50-B-15ZHello! Pls my Satellite C50-B-15Z newly purchased does not recognize discs when inserted. It dosent play any CD or DVD drive, or it even recognize it at all. Pls help... What should I do?

  • Pavilion DV7-1260us: loading a laptop battery

    It's probably a question of 'stupid', but not the power supply for laptop also recharge the battery? Hardly, I used my laptop without the AC is plugged in, but the battery must be dead because he does not work on battery alone. the power supply must

  • How can I remove homepage awsome

    How can I remove awsome homepage?

  • WRT400N has continued problems iPhone

    Hi all - I'm generally pretty well understand these things, but I can't for the life of figure me out how to get the connection from my iPhone to stop the fall of my WRT400N.   I've updated firmware, done reset hard reset the network settings on the