Re: utl_smtp.rcpt and multiple emails



On Sep 28, 6:13 pm, jobs <j...@xxxxxxxxxx> wrote:
thank you.

now if only i can figure out how to split a string in 9i. This
apparently is a 10 g thing.

myarray := split(sendto, ',');

Nothing very complex here, writing a split function is pretty trivial
in PL/SQL (assuming that myarray is a PL/SQL collection, if it's an
SQL collection type (a nested table or a VARRAY) then you will need to
extend the array before adding value to it using array.extend()
method):

function split( s in varchar2, delim in varchar2 := ',') return
myarray
is
rv myarray;
ix pls_integer := 1; -- index into the array
d_pos pls_integer; -- delimiter position
l_s varchar2(32765) := s; -- working local copy of the string
begin
loop
exit when l_s is null; -- exit when the source string
is empty
d_pos := instr(l_s,delim); -- next delimiter position
if d_pos > 0 then -- found it
rv(ix) := substr(l_s,1,d_pos-1); -- extract next token
ix := ix + 1; -- advance the array index
(sometimes I miss C ++ syntax... :))
l_s := substr(l_s, d_pos+1); -- trim the token from the
source string
else
rv(ix) := l_s; -- there's only one token in
the source string
l_s := null; -- indicate that we're done
end if;
end loop;
return rv;
end split;

If you are going to create this function standalone (that is, not in a
package,) then I'd suggest that you use a nested table type for output
- you'll have an additional benefit of being able to query this
function as if it was a table ( SELECT * FROM TABLE(split(...)) ) and
make it pipelined to speed up things a bit. See the docs for details
on these features if you are not familiar with them (TABLE() function
and pipelined functions.)

Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com

.



Relevant Pages

  • Re: ListBox question
    ... other than a String, the compiler would complain. ... Dim myArray As Variant ... Dim myLong As Long ... I tested by entering a 'plain textbox shape' ...
    (microsoft.public.word.vba.general)
  • Re: ListBox question
    ... split by the second string. ... element of myArray like the the SplitTest subroutine did to set each textbox ... Dim myLong As Long ... And your listbox is named ListBox1 ...
    (microsoft.public.word.vba.general)
  • Re: Populate an array with random numbers
    ... now myList will have an Add method that requires a string. ... Effectively he is starting with a deck of 5 cards and dealing ... them out to myArray in random order. ... needs to be removed from potList so that it cannot be dealt again. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ListBox question
    ... split by the second string. ... element of myArray like the the SplitTest subroutine did to set each textbox ... Dim myLong As Long ... And your listbox is named ListBox1 ...
    (microsoft.public.word.vba.general)
  • Re: Populate an array with random numbers
    ... I just wanted to thank you for you simple concise explanation of Morten's code it was extremely helpful. ... now myList will have an Add method that requires a string. ... He is getting a random element from potList, putting it into myArray and then removing that element from the potList on the next line. ... As each "card" is dealt to myArray it needs to be removed from potList so that it cannot be dealt again. ...
    (microsoft.public.dotnet.languages.csharp)