Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: in PL/SQL : String replace on some condiations - i hate IF ELSE
In article <1118735821.222784.117370_at_o13g2000cwo.googlegroups.com>, baka
says...
> If i take this approach all the lines in the beg----end block of step
> 3 will be checked and its waste of Resources. and i do not want use IF
> ELSE clause.
>
> Any one have better solution to this problem,
I don't but I don't think that what you have coded is an unreasonable way of handling the problem.
However (and this not solving your problem in a different way) I would suggest that the CITY/COUNTY pairs be loaded into a table and then read into an array at the start of execution. Then instead of your multiple replace statments just have one within a loop such as:
for i in 1..cities.count
outputstr=REPLACE(td_rec.colstr,city(i),country(i));
end loop;
Another potential problem springs to mind actually - you would need to ensure that the string you are seeking to replace doesn't exist as part of another word or elsewhere in the data....
-- jeremyReceived on Tue Jun 14 2005 - 03:10:09 CDT
![]() |
![]() |