Results 1 to 3 of 3

Thread: String Splits

  1. #1
    Join Date
    Mar 2002
    Posts
    20

    Question Unanswered: String Splits

    Hi,

    I am using Oracle 8i PL/SQL:

    How do I perform a String split into an array within my pl/sql function ?

    e.g.

    myStr = "ds,33,t,dfdf,i,99,o"

    Thanks

  2. #2
    Join Date
    Mar 2002
    Posts
    20
    This bit of code is fine for strings:

    e.g. call splitString('dfd,sdfsf,dsf');

    -> but for numbers will not work e.g. (45,34,23), the problem being the COMMA_TO_TABLE oracle function

    procedure splitString ( mystring varchar2 ) as
    mytab dbms_utility.uncl_array;
    tablen number;
    begin
    dbms_utility.COMMA_TO_TABLE(mystring,tablen,mytab) ;
    for i in 1..tablen
    loop
    dbms_output.put_line('The '||i||' name is '||substr(mytab(i),1,25));
    end loop;
    end;

  3. #3
    Join Date
    Jul 2003
    Posts
    2,296
    put the numbers in quotes just like your text.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •