Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: split string into an array by some delimiter using 9i?
On Sep 28, 10:56 am, jobs <j..._at_webdos.com> wrote:
> apparently I can't do this in 9i?
>
> myarray := split(sendto, ',');
>
> Any easy way to do it?
>
> Thanks fo rnay help or information.
Here's a function that will do what you want.
FUNCTION split_text(text_ids IN VARCHAR2 ,delim VARCHAR2 ,return_nulls BOOLEAN) RETURN varchar_tab PIPELINED IS vn_idx PLS_INTEGER;
vc_next_string := substr(vc_text_ids, 1, vn_idx - 1); IF vc_next_string IS NOT NULL OR return_nulls THEN PIPE ROW(vc_next_string); END IF; vc_text_ids := ltrim(substr(vc_text_ids, vn_idx +length(delim)));
ELSE
IF vc_text_ids IS NOT NULL OR return_nulls THEN PIPE ROW(vc_text_ids); END IF; EXIT;