explode a string into array elements

Is this a way to explode a string into elements of array in oracle?
as ' has. B | C | D | E' in
5 separate strings?

If so, how do I?
Please guide me with some examples.

Thank you

Here is a way by using the loop.

SQL> SET SERVEROUTPUT ON;
SQL>
SQL> DECLARE
  2    vValue VARCHAR2(10):='ABCDEFGHI';
  3  BEGIN
  4    FOR A IN 1..LENGTH(vValue) LOOP
  5      DBMS_OUTPUT.PUT_LINE(SUBSTR(vValue,A,1));
  6    END LOOP;
  7  END;
  8  /
A
B
C
D
E
F
G
H
I

PL/SQL procedure successfully completed.

Here's another way to query too ;)

SELECT SUBSTR('ABCDEFGHI',LEVEL,1) VALUE
FROM DUAL
CONNECT BY LEVEL <= LENGTH('ABCDEFGHI');

-Clément

Published by: Hannah on May 8, 2010 10:01
Query added.

Tags: Oracle Development

Similar Questions

  • Convert the text string into array of words

    I'm trying to convert an input string of sentence written with spaces between words in an array of strings of 1 d with one word in each element of the array.

    That's what I have so far, but his does not work as I would like.   I have trouble getting in the array to zero at the beginning of each series.

    Thank you

    Why don't you just use the String Array to worksheet and specify a space as a separator?

  • convert string into array of char

    What is the best way to convert a string to an array of characters?

    Thank you.

    String to byte array

  • Deactivation of entry into ARRAY elements empty?

    LV 2010.0

    I have a problem with the user interface.

    I have a pile of things to input, organized as a line.

    On a front, I have a table of these lines, then the user can change current test mode and coming patterns.

    The table has control of the hidden CLUE.

    I have room for 15 rows on the Panel.

    15 enough for 90% of the cases, but for the others, I use the vertical scroll bar of the table.

    The problem is, if I have 20 rows (0.19) in the table, the scroll bar doesn't let me scroll down and show me the #20 element, which is empty.

    It will allow me to grab something in line 20, and then it will allow me to scroll to #21, etc., etc.

    I want to avoid this.  I ADD a button to create a line as I want.  The line entering zeros is not good (some fields are constants of P-I-D).

    Without forgetting that highlighting is done via a color behind number fields box, when this so-called line appears, the default color is black, which is dimmed by the fact that it is non-existent to a ugly gray. That matches the color of the text is a large grey band.

    I already have code to detect a mouse click and highlight the row that is clicked.  In order to detect a click on the BOGU line and throw the event, which means that you can not actually create a new item.  It is necessary for the safety of the machine and everything works fine.

    But how can I stop popping up?

    Is there are 15 or fewer lines in the test, I put the NUMROWS to however much I and hide the scroll bar.  It is very good.  But I need of the scrollbar for the trials. But he insists on showing me N + 1.

    I could query the VALUES of INDEX property and if it gets to the point where the false line shows, I change it back.  But it's a hack ugly, big-time.

    I see not all properties to adjust the boundaries of the scroll bar. I don't see a property to not allow NEW ELEMENTS.

    Is there something I can do?

    I think I have said have posted an example in this thread. If not the final solution, I think that you get to halfway. As I said, I've seen this fact.

    Ben

  • reclassification how to convert string into array

    Hi all


    I do the code

    CREATE OR REPLACE
    TYPE 'SAMPLE '. "" SAMPLETABLETYPEVAR ".

    PLS-00311:

    but I got to l_data error how can I solve

    /***************************************************************/
    declare
    l_str DEFAULT LONG ' pankaj/dukare /';
    l_n NUMBER;
    SAMPLETABLETYPEVAR l_data: = SAMPLETABLETYPEVAR ();

    BEGIN

    LOOP
    l_n: = INSTR (l_str, "/");
    WHEN the OUTPUT (NVL (l_n, 0) = 0);
    l_data. EXTEND;
    l_data (l_data. (COUNTY): = LTRIM (RTRIM (SUBSTR (l_str, 1, l_n - 1)));
    l_str: = SUBSTR (l_str, l_n + 1);
    END LOOP;

    L_data RETURN;

    END;

    /********************************************************/

    Published by: user9524857 on July 1st, 2009 23:36

    using your code:

    SQL> select *
      2    from table (sample_split_string ('this is a long string', ' ')
      3  /
    
    COLUMN_VALUE
    ---------------------------------------------------------------------
    this
    is
    a
    long
    string
    
  • How to parse this string into an array

    Someone sees an easy way to parse this string into an array of type

    [Street 1, 2, city, zip code]

    the string:

    '

    [

    [address = "Paris Ltd, 5 North Street, Athens, SW1X 9the"]

    [address = "Paris Ltd, 5 North Street, Athens, SW1X 9the"]

    ]

    '

    THX

    If you want just the address as a single entry as myArray [1] = 'Paris Ltd, 5 North, Athens, SW1X 9A Street', then try this:

    If you really want the different elements had a blast, you would need a picture of structures, so you get .street1 myArray [1] = 'Paris Ltd ':

    Note: As Steve has pointed out, you may need to test for listLen() on the addressList object to determine whether or not there is a street.2 entry in any given row.

  • A fundamental question/problem with the like undefined array element

    Hello everyone,

    Thanks for looking at my problem. I am very new script and javaScript, and I encountered a strange problem. I always try to solve all my problem myself, with documentation (it helps to learn) or as a last resort with the help of google. But in this case, I'm stuck. I'm sure its something very simple and elementary.

    Here I have a code that simply loads a text file (txt), load the contents of the file in a "var glad." This summary text file a font family name, every name on a new line, as:

    Albertus

    Antenna

    Antique

    Arial

    Arimo

    Front

    Barber1

    Barber2

    Barber3

    Barber4

    Birch

    Blackoak... .etc

    Now I hollow the variable content of loop, extract each letter and add it to the list '[i]' table. If the character is a line break the list [i] table adds another element (i = i + 1); That's how I separate each name in its own element of array.

    The problem I encounter is, when I have hollow loop table fontList and $.writeln (fontList [i]) is the result in the console :

    undefinedAlbertus

    undefinedAntenna

    undefinedAntique

    undefinedArial... etc.

    I don't get serious, where the undefined comes? As far as I tested each digit to be added to the array element, I see nothing extraordinary.

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

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

    Here is my code:

    #target illustrator

    var doc = app.documents.add ();

    Open the file

    var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");

    openFile var = myFile.open ("r");

    check if it is open

    if(OpenFile == true) {}

    {$.writeln ("the file has loaded")}

    else {$.writeln ("the file does not load, check the name or the path") ;}}

    load the contents of the file into a variable

    var content = myFile.read ();

    myFile.close ();

    var ch;

    var x = 0;

    var fontList = [];

    for (var i = 0; i < content.length; i ++) {}

    ch = content.charAt (i);

    If ((ch)! == (string.fromCharCode(0)) (10))) {}

    fontList [x] += ch;

    }

    else {}

    x ++;

    }

    }

    for (i = 0; i < fontList.length; i ++) {}

    $.writeln (fontList [i]);

    }

    doc. Close (SaveOptions.DONOTSAVECHANGES);

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

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

    Thanks for any help or an explanation. If you have any tips on how to improve my practices or any suspicion, please do not hesitate to say. Thank you

    Hi vladac54380629,

    better, you try something like this:

    #target illustrator
    
    //var doc = app.documents.add(); 
    
    //open file
    var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");
    var openFile = myFile.open("r"); 
    
    //check if open
    if(openFile == true){
        $.writeln("The file has loaded")}
    else {$.writeln("The file did not load, check the name or the path");} 
    
    //load the file content into a variable
    var fontList = []; 
    
    var content = myFile.read();
    fontList = content.split ("\n")
    myFile.close(); 
    
    for ( i = 0; i < fontList.length; i++) {
       $.writeln(fontList[i]);
      }
    
    //doc.close (SaveOptions.DONOTSAVECHANGES);
    

    Have fun

    A note:

    The real font names may be different from your own list for example:

    Arial! = ArialMT

    Birch! = BirchStd

    Blackoak! = BlackoakStd

    Concerning

  • read part of an array element

    Hi all.

    As indicated in the title, I'm reading part of an array element.

    What I'm doing is reading a LeCroy scope values using a 'write' 'read' I returned the values in a table, but the question is the scope returns a value of "1, 52.33E - 3".

    I just want the element to be 52,33 so I can use it for other calculations.

    For example, my table.

    ' 1, 34.334E - 3.

    ' 1, 53.343E - 3.

    ' 1, 143.232E-

    And I want it to be

    34.334

    53.343

    143.232

    Thank you!

    Use string functions (match pattern) to find the comma. Then convert the part after the comma to a number using the string appropriate to the Number function.

    Are throwing you what looks like an exhibitor intentionally?

    The last string seems to miss the exhibitor. This suggests you may have problems with your communications with the instrument.

    Lynn

  • Impossible to insert a 1 d table in a 2D array using "insert into array.

    Hi all

    I have a very simple problem.

    I try to insert a table 1 d as a column in a table 2D using 'insert into array"as stated in image1.

    When I try to connect the table 1 d in the "new element/sub-table" terminal I get the error indicated in image2.

    According to the help files, I should be able to wire a table of size n-1 this as the 'new item/sub-table"terminal. In other words

    I should be able to connect a table 1 d here.

    Can someone tell me what I am doing wrong?

    Thanks for your help,

    Apparently I had converted the table to float in a 'worksheet chain' and I needed to convert it into an array before sending it to 'insert into array.

    Discover image3 for more details.

  • split a string into pl/sql

    Hello

    How to split a string and store in an associative array in pl/sql.function

    My string like this

    '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001'
    and assign it to the array list. According to
    can someone please help

    concerning
    r

    You can try the following. Although I recommend, it would be better to write the function code php as a java stored procedure parser and use the result. We have a class defined in Java String Tokenizer.

    -- Define function to split string into tokens
    FUNCTION get_token(
        p_input_string IN VARCHAR2,            -- input string
        p_token_number IN PLS_INTEGER,         -- token number
        p_delimiter    IN VARCHAR2 DEFAULT ',' -- separator character
      )
      RETURN VARCHAR2
    IS
      v_temp_string VARCHAR2(32767) := p_delimiter || p_input_string ;
      v_pos1 PLS_INTEGER ;
      v_pos2 PLS_INTEGER ;
    BEGIN
      v_pos1     := INSTR( v_temp_string, p_delimiter, 1, p_token_number ) ;
      IF v_pos1   > 0 THEN
        v_pos2   := INSTR( v_temp_string, p_delimiter, 1, p_token_number + 1) ;
        IF v_pos2 = 0 THEN
          v_pos2 := LENGTH( v_temp_string ) + 1 ;
        END IF ;
        RETURN( SUBSTR( v_temp_string, v_pos1+1, v_pos2 - v_pos1-1 ) ) ;
      ELSE
        RETURN NULL ;
      END IF ;
    EXCEPTION
      WHEN OTHERS THEN
        RAISE;
    END get_token;
    
    -- Call the above function in loop for a string with N tokens
    DECLARE
          TYPE assoc_arr_str_typ IS TABLE OF VARCHAR2(100) INDEX BY PLS_INTEGER;
          str_arr assoc_arr_str_typ;
    
          v_str VARCHAR2(200) := '1102,1101,1012,1011,1010,1009,1008,1007,1006,10005,1004,1003,1002,1001' ;
          v_token   VARCHAR2(4) ;
          i          PLS_INTEGER := 1 ;
        BEGIN
          LOOP
            v_token := get_token( v_str, i , ',') ;
            EXIT WHEN v_token IS NULL ;
            dbms_output.put_line( v_token ) ;
            str_arr(i) := v_token;
            i := i + 1 ;
         END LOOP ;
      END ;
     /
    

    Published by: GG 24 March 2011 09:51

  • How can I make the best use of a new external hard drive and a new catalog full of photos just loaded into Photoshop elements 14 Organizer?

    How can I make the best use of a new external hard drive and a new catalog full of photos just loaded into Photoshop elements 14 Organizer?

    Keep all the files on external hard drive image?  Nothing else and no pictures on the desktop?

    Keep all image files both places?

    What is the best way to go through thousands of images in the Organizer to identify and place them in files?

    Once I've placed a file, I just leave it in the entire catalog or a way indicate to me that it has been sorted?

    As overwhelming, any tips/shortcuts/schemes, you can offer are welcome!

    As I only have the version of the EP, here is some info on the organiser:

    https://helpx.Adobe.com/Photoshop-elements/how-to/use-elements-Organizer.html

    Independent of how this feature works, you want to have your photos in one place and have a backup (second copy) somewhere else. All hard drives will not be successful at some point - some more early, some late - never trust to have your files in any safety devices if they are on a single disc. Once you have your sorted, it would be useful that you will organize/name/tag new photos immediately if the task is relatively short and simple. I copy my photos on my internal hard drive for my camera, take a quick look with preview to see who needs some changes and then decide where to put them - either drop them immediately after naming them or bring in an editing application and then file them away.

  • array element references confused me

    Then... I'm playing with references to arrays, specifically references to items in a table.

    It seems that I should be able to read the value of the table, but because of how I am tying TestStand and LabVIEW, I am trying to create a utility that automatically obtain data back between the LV and TS, where the types of data passed back are completely unknown and, possibly, paintings of beams that have tables nested clusters.

    I try to walk the LV data structure and reference TestStand and get the right data.  However, I can't seem to be able to use references to point to specific elements of a table - see example I expect the high and the low code works the same, but they do not.

    Any suggestions on what I do wrong to get the top and bottom to work the same?

    LV2011 attached code

    Ravens fan wrote:

    Property of the array element node gives you a reference to the element that makes up the table.  So if you set the properties of a digital control maybe to change the color or display format.

    Is not a way to get or set the value of a specific array element.  To set a particular array element, you must use replace table subset.  To get the value of a particular array element, you use table to index.

    Indexvalues property node is used to determine which is the first item that appears.  It changes the value of the indexer the upper left corner of the table.

    One thing I noticed that I don't know if I knew before, it was this setting the property value on the reference of array element, node will have an impact on the first element of visible table.  If you turn the highlight performance and play with array index, while it is running, you will see that the resulting table will be different.

    Although it IS possible, you can not do after seeing what it takes.

    We can get the value of an array element that is in a control or indicator provided it it the upper left display element.

    This nugget exploits that factand see how it can be done. Note: I have not tested this code lately so I don't know if NEITHER broke this behavior since the writing of this nugget.

    Ben

  • Reference to the array of Clusters with an array element

    Hello

    I have an array of clusters of CONTROL (qualifying as "upper-tier cluster table") with one of the items is an array of cluster cluster (see attached).

    I intend to "reference" of this cluster of high level at different screws (as add item VI, insert item VI, delete the item VI etc.) and access (add/edit delete) the elements of this array.

    In my code, how I cataloged the array element (cluster) on the cluster internal (as shown on the figure)?

    I use LV RT on PXI.

    Hello smercurio_fc,

    Thank you for your example! Just a question: actually, with shift registers, is an example of creating a local copy of the full range? Even if the value of the lowest level cluster is changed, is the complete table is updated at the end (registry value to offset the full picture at the right end is updated using the reference node and property)? This VI will be slow when the size of the array becomes great?

    Comment of nicely.

  • Get all the different values in a table - 'or array elements' does not work with I32

    Hello

    I just found out that "array elements or" does not work with a table 1 d of integer values. I didn't expect that.

    I did a semi quick forum search and did not find a pointer to an effective solution. Can someone give me a hint?

    Do not back my initial intention is to list all the values that appear in an array of integers.

    I thought that if I converted the figures for powers of 2 and or I had solved the problem at hand - only to discover that the elements of array does not.

    If someone could propose a different approach, I'd be happy too.

    I should mention that the execution time is a factor here - I need a fast code, but any suggestions are welcome because they could help me get started.

    Best regards Florian

    Hi Florian.

    try this:

    "Function, it seems, the table of GOLD ' is polymorphic (as written in the context-sensitive help), but does not support arrays of I32. At least the error message means just that...

  • How can you specify the default value for the undefined array elements

    According to aid LV, the tables have two default values, the normal default value and the default value for the undefined array elements.

    I assume that there must be a way to specify the default value for later, but I can't find it anywhere.  Any ideas?

    I know that you can drag the item out of the table container.  Change the default value on this scalar element.  Then drag the item in table tank.

Maybe you are looking for

  • "Can not detect 2 HDD on the system" error starting hp Pavilion G7 11002sa

    I am not able to start my laptop g7 pavilion and when I press F11 to recover from HP recovery is not allowing me to and tells me that it cannot detect hard drives on my system. I didn't something different on my laptop, but the last time, he displaye

  • Qosmio G35: How to create Qosmio Player CD image

    Hello I am Brazilian and I have a Qosmio G35 AV600.A month ago, I deleted all my partitions and after I reinstalled the operating system, I realized that he lacked QosmioPlayer. Software based on the web that I discovered that I need the Qosmio playe

  • HP Elite 8200 CMT: EVGA GeForce GTX 750 Ti 2 GB on HP Elite 8200 CMT

    HelloI'm looking for an upgrade of my graphics card so that I can play the latest games. I have a HP 8200 Elite Convertible Minitowers PC as the here:http://h20564.www2.HP.com/hpsc/doc/public/display?docLo...It has the following features:CPU: Intel C

  • Smartphones with Verizon blackBerry torch

    I have a blackberry "BOLD", but I really want the torch. However, my career is Verizon. I wonder if I can buy the torch at a place like Walmart or where ever else they are sold and then use with Verizon. Or is it impossible? Should I move to AT & T t

  • Your disk partition bort I have Win 7

    Hej, 130417 JAG har haft en real HD I have min med Win 7 dator. In nu jag har SSD, ens ut den gamla och s. Den gamla har nu VAT partitioner och jag inte kan your bort den enna. JAG har forsoht m Diskhantering men jag ser ingen menu 'your partition of