Re: substr-function

From: Daniel A. Morgan <Daniel.Morgan_at_attws.com>
Date: Wed, 18 Jul 2001 09:55:38 -0700
Message-ID: <3B55BF8A.330E3D83_at_attws.com>


Noel wrote:

> Hope it would help you.
>
> Here is the example:
>
> DECLARE
>
> source VARCHAR2(2000);
> dest VARCHAR2(2000);
> x NUMBER;
> str1 VARCHAR2(100) := 'http://182.44.236.3';
> str2 VARCHAR2(100) := 'http://mysite.com';
>
> BEGIN
>
> source := 'Please contact at http://182.44.236.3 for more information.';
> x := INSTR(source, str1);
> dest := SUBSTR(source, 1, x - 1)||str2||SUBSTR(source, x + length(str1));
> DBMS_OUTPUT.Put_Line(source);
> DBMS_OUTPUT.Put_Line(dest);
>
> END;
> /
>
> Uzytkownik "Gomber_at_Home" <sgomber_at_adlink.net> napisal w wiadomosci
> news:3B54ABDF.1790060D_at_adlink.net...
> > Hi,
> > i need some help on generating the right syntax for my specific problem
> > - i need to exchange some characters in a string for each appearance in
> > the clomn, e.g 'http://182.44.236.3' to 'http://mysite.com' ... i've
> > already played around with it for a while but i don't know how to built
> > up the command...
> >
> >
> > thanks a lot in advance
> >
> > Sven
> >
> >
> >
> >

Assuming that you know in advance the string you are looking for you could easily wrote a procedure that would use the REPLACE built-in function and avoid instr and substr and concatenation.

Daniel A. Morgan Received on Wed Jul 18 2001 - 18:55:38 CEST

Original text of this message