Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> best way to loop over string value character by character

best way to loop over string value character by character

From: steph <stephan0h_at_gmx.net>
Date: 2 Sep 2005 03:41:36 -0700
Message-ID: <1125657696.588345.232860@g14g2000cwa.googlegroups.com>


What's the best (most performant) way to loop over a string value character by character?

We've implemented it like this:

  for i in 1 .. length(v_str) loop
    c:= substr(v_str,i,1);
  end loop;

I wonder if there is a better way for this. Maybe by not calling substr(), something like this:

  for i in 1 .. length(v_str) loop
    c:= v_str[i];
  end loop;

Is it (easily) possible to convert the string into an array (and loop over the array consequently)?

thanks,
stephan Received on Fri Sep 02 2005 - 05:41:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US