Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:45:43+00:00 2026-05-16T23:45:43+00:00

I need to write a procedure to normalize a record that have multiple tokens

  • 0

I need to write a procedure to normalize a record that have multiple tokens concatenated by one char. I need to obtain these tokens splitting the string and insert each one as a new record in a table. Does Oracle have something like a “split” function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:45:43+00:00Added an answer on May 16, 2026 at 11:45 pm

    You have to roll your own. E.g.,

    /* from :http://www.builderau.com.au/architect/database/soa/Create-functions-to-join-and-split-strings-in-Oracle/0,339024547,339129882,00.htm
    
    select split('foo,bar,zoo') from dual;
    select * from table(split('foo,bar,zoo'));
    
    pipelined function is SQL only (no PL/SQL !)
    */
    
    create or replace type split_tbl as table of varchar2(32767);
    /
    show errors
    
    create or replace function split
    (
        p_list varchar2,
        p_del varchar2 := ','
    ) return split_tbl pipelined
    is
        l_idx    pls_integer;
        l_list    varchar2(32767) := p_list;
        l_value    varchar2(32767);
    begin
        loop
            l_idx := instr(l_list,p_del);
            if l_idx > 0 then
                pipe row(substr(l_list,1,l_idx-1));
                l_list := substr(l_list,l_idx+length(p_del));
    
            else
                pipe row(l_list);
                exit;
            end if;
        end loop;
        return;
    end split;
    /
    show errors;
    
    /* An own implementation. */
    
    create or replace function split2(
      list in varchar2,
      delimiter in varchar2 default ','
    ) return split_tbl as
      splitted split_tbl := split_tbl();
      i pls_integer := 0;
      list_ varchar2(32767) := list;
    begin
      loop
        i := instr(list_, delimiter);
        if i > 0 then
          splitted.extend(1);
          splitted(splitted.last) := substr(list_, 1, i - 1);
          list_ := substr(list_, i + length(delimiter));
        else
          splitted.extend(1);
          splitted(splitted.last) := list_;
          return splitted;
        end if;
      end loop;
    end;
    /
    show errors
    
    declare
      got split_tbl;
    
      procedure print(tbl in split_tbl) as
      begin
        for i in tbl.first .. tbl.last loop
          dbms_output.put_line(i || ' = ' || tbl(i));
        end loop;
      end;
    
    begin
      got := split2('foo,bar,zoo');
      print(got);
      print(split2('1 2 3 4 5', ' '));
    end;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write stored procedure that gets string. Each char in string have
I need to write a generic procedure that set value for one column or
I need to write a procedure that will allow me to select x amount
I need to write a stored procedure to update one of a set of
I need to write a stored procedure that will provide the data from two
I need to write a procedure where I have to sum an unknown column
I have a binary string that I need to write to a file. I
I need to write a stored procedure that will search a table based on
In Oracle PL/SQL I need to write a stored procedure that may throw a
I need to write a function that rounds time in one column to start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.