Thread: Replace function ...

Replace function ...

From
"Kornelije"
Date:
Hi,
 
I need to write a function which has to replace a character with two or three other characters ....
 
I have some data in the DB and when I retrieve this data, I have sorting problems because I use specific Croatian characters ....
I know that the DB is not setup properly, but I cannot change anything now because some data could be lost ....
 
So I need to change specific Croatian characters with some other standard characters in order to sort the data properly ....
 
so, if anybody knows something or has such function, please, let me know ....
 
thanks
 
R.K.

Re: Replace function ...

From
Yasir Malik
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I need to write a function which has to replace a character with two or three other characters ....
>

You can use the replace function as specified below:
replace(string text, from text, to text) textReplace all occurrences in @string of substring @from with substring @to.

replace( 'abcdefabcdef', 'cd', 'XX') ==> abXXefabXXef

Yasir
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iQEVAwUBQKkT1+J7vYSSIbWdAQL/5QgAmCdJrYh4YjJFWKeWNk+OEuhpvRNYbRlM
tH5dezmUrR4fkM4l2mfrmuIkTT+rqQNyRR3E5PhKyfkbnHdw7/WPalqGSbX1aIfP
YZI/RdxH/Aqy+hO+zcUQzSjpYSEyKrmTVGLmRf+tyYg0QdZdAQFd6O9aKWMeCo28
TFKRFAlg+glT/YiN1JiwzF/QygBNmo3g+JDWZ+U8Au+y0fHh/3KeoyLx9ipMSqs/
uBiy8eNjOdAF3ihoydDw2uBpzjwtGv9eeR0Myh8m4Zvx9K239NVSz4s9a+2R1Onf
Mr5PK7Te5TG8TLcjJyo35x8yC/57oufNvWoi+Q6Y7cmSxeiEcHzJiw==
=xChX
-----END PGP SIGNATURE-----


Re: Replace function ...

From
Benoît BOURNON
Date:
I try to reencode postgresql db ... all is running ... in your shell :

- pg_dump db  -f fileout

- iconv fileout i do not remember parameters but iconv converts the file.

- createdb db -U unicode (for example)

- pgsql db < fileout_converted


We change previous year the encoding of this website : www.ape-europe.org
'iso' to 'utf8' for problems of eastern countries ...
all is running ...

maybe you can try ...

Kornelije wrote:
Hi,
 
I need to write a function which has to replace a character with two or three other characters ....
 
I have some data in the DB and when I retrieve this data, I have sorting problems because I use specific Croatian characters ....
I know that the DB is not setup properly, but I cannot change anything now because some data could be lost ....
 
So I need to change specific Croatian characters with some other standard characters in order to sort the data properly ....
 
so, if anybody knows something or has such function, please, let me know ....
 
thanks
 
R.K.

Re: Replace function ...

From
Kornelije Rabuzin
Date:
Thank you very much, but the database I'm using is not mine ....
that's why I cannot change anything ....

If I wont manage to write this replace function, I'll probably use this
solution ...

so thank you

best regards


R. K.

On Wed, 19 May 2004, [ISO-8859-1] Beno�t BOURNON wrote:

> I try to reencode postgresql db ... all is running ... in your shell :
>
> - pg_dump db  -f fileout
>
> - iconv fileout i do not remember parameters but iconv converts the file.
>
> - createdb db -U unicode (for example)
>
> - pgsql db < fileout_converted
>
>
> We change previous year the encoding of this website : www.ape-europe.org
> 'iso' to 'utf8' for problems of eastern countries ...
> all is running ...
>
> maybe you can try ...
>
> Kornelije wrote:
>
> > Hi,
> >
> > I need to write a function which has to replace a character with two
> > or three other characters ....
> >
> > I have some data in the DB and when I retrieve this data, I have
> > sorting problems because I use specific Croatian characters ....
> > I know that the DB is not setup properly, but I cannot change anything
> > now because some data could be lost ....
> >
> > So I need to change specific Croatian characters with some other
> > standard characters in order to sort the data properly ....
> >
> > so, if anybody knows something or has such function, please, let me
> > know ....
> >
> > thanks
> >
> > R.K.
>
>


Re: Replace function ...

From
Kornelije Rabuzin
Date:
thanks ....

If I don't find some other solution, I'll do it .....

so, thanks ...

best regards


Kornelije


On Wed, 19 May 2004, BenLaKnet wrote:

> I try to reencode postgresql db ... all is running ... in your shell :
>
> - pg_dump db  -f fileout
>
> - iconv fileout i do not remember parameters but iconv converts the file.
>
> - createdb db -U unicode (for example)
>
> - pgsql db < fileout_converted
>
>
> We change previous year the encoding of this website : www.ape-europe.org
> 'iso' to 'utf8' for problems of eastern countries ...
> all is running ...
>
> maybe you can try ...
>
> Kornelije wrote:
>
> > Hi,
> >
> > I need to write a function which has to replace a character with two
> > or three other characters ....
> >
> > I have some data in the DB and when I retrieve this data, I have
> > sorting problems because I use specific Croatian characters ....
> > I know that the DB is not setup properly, but I cannot change anything
> > now because some data could be lost ....
> >
> > So I need to change specific Croatian characters with some other
> > standard characters in order to sort the data properly ....
> >
> > so, if anybody knows something or has such function, please, let me
> > know ....
> >
> > thanks
> >
> > R.K.
>
>