Re: PL/SQL character Array

From: Mohamed Javid <mjavid_at_sprynet.com>
Date: Sun, 06 Dec 1998 11:37:48 -0500
Message-ID: <366AB2DC.791882E0_at_sprynet.com>


You could also do this using substr like this

for st_pos in 1..length(var)
loop
.....

    var := substr(var,1,st_pos-1) || substr(var, st_pos,1)|| substr(var,st_pos+1);
.....
end loop;

and put it in a loop if you want to parse every character in the variable var

HTH Jim wrote:

> You could either write it youself (not too difficult) or you could try the
> PLVision stuff that Steven Feuerstein does.
> I'm pretty sure you get some parsing packages with his Oracle PL/SQL
> Programming book (O'Reilly)
> Jim
>
> Joe Condle <condle_at_med.pitt.edu> wrote in article
> <36656223.76D7_at_med.pitt.edu>...
> > How can I access individual postions in a string variable in PL/SQL?
> > In C I would just declare a char string[10}. If I wanted to put the
> > letter J in the third postion I would just do string[3] = "J".
> > Is there a way to do this in PL/SQL? I have to build a Y/N string based
> > on which values are fetched from the database.
> > Example
> > If ATTEND is fetched then a Y goes into the first postion if not N. If
> > REFER is fetched then Y goes into the third position and so on. I end
> > up witha string YNYYY. I would like to build a procedure that looks at
> > the value checks in against the the 5 choices and return a Y or N and
> > places it in the right position of my string.
> > Any suggestions?
> >
> > -Joe
> >
Received on Sun Dec 06 1998 - 17:37:48 CET

Original text of this message