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 -> Re: in PL/SQL : String replace on some condiations - i hate IF ELSE

Re: in PL/SQL : String replace on some condiations - i hate IF ELSE

From: Jeremy <newspostings_at_hazelweb.co.uk>
Date: Tue, 14 Jun 2005 09:10:09 +0100
Message-ID: <MPG.1d18a1328918d6eb989eb9@news.individual.net>


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....

-- 

jeremy
Received on Tue Jun 14 2005 - 03:10:09 CDT

Original text of this message

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