Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[SQL] Replace function ...

0 views
Skip to first unread message

Kornelije

unread,
May 17, 2004, 3:25:45 PM5/17/04
to
This is a multi-part message in MIME format.

------=_NextPart_000_0092_01C43C30.23E31D40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

I need to write a function which has to replace a character with two or thr=
ee other characters ....

I have some data in the DB and when I retrieve this data, I have sorting pr=
oblems 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 c=
haracters in order to sort the data properly ....

so, if anybody knows something or has such function, please, let me know ..=
..

thanks

R.K.
------=_NextPart_000_0092_01C43C30.23E31D40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I need to write a function which has to re=
place a=20
character with two or three other characters ....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have some data in the DB and when I retr=
ieve this=20
data, I have sorting problems because I use specific Croatian characters=20
....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I know that the DB is not setup properly, =
but I=20
cannot change anything now&nbsp;because some data could be=20
lost&nbsp;....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>So I need to change specific Croatian char=
acters=20
with some other standard characters in order to sort the data properly=20
....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>so, if anybody knows something or has such=
=20
function, please, let me know ....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>R.K.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0092_01C43C30.23E31D40--


Yasir Malik

unread,
May 17, 2004, 3:48:32 PM5/17/04
to
-----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) text
Replace 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-----

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Benoît BOURNON

unread,
May 20, 2004, 1:02:36 PM5/20/04
to
This is a multi-part message in MIME format.
--------------040407010604050501030203
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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.


--------------040407010604050501030203
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I try to reencode postgresql db ... all is running ... in your shell :<br>
<br>
- pg_dump db&nbsp; -f fileout<br>
<br>
- iconv fileout i do not remember parameters but iconv converts the
file.<br>
<br>
- createdb db -U unicode (for example)<br>
<br>
- pgsql db &lt; fileout_converted<br>
<br>
<br>
We change previous year the encoding of this website :
<a class="moz-txt-link-abbreviated" href="http://www.ape-europe.org">www.ape-europe.org</a><br>
'iso' to 'utf8' for problems of eastern countries ...<br>
all is running ...<br>
<br>
maybe you can try ... <br>
<br>
Kornelije wrote:
<blockquote cite="mid009501c43c1f$63d39580$b103a8c0@krabuzin"
type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2800.1400" name="GENERATOR">
<style></style>
<div><font face="Arial" size="2">Hi,</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I need to write a function which has
to replace a character with two or three other characters ....</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">I have some data in the DB and when
I retrieve this data, I have sorting problems because I use specific
Croatian characters ....</font></div>
<div><font face="Arial" size="2">I know that the DB is not setup
properly, but I cannot change anything now&nbsp;because some data could be
lost&nbsp;....</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">So I need to change specific
Croatian characters with some other standard characters in order to
sort the data properly ....</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">so, if anybody knows something or
has such function, please, let me know ....</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">thanks</font></div>
<div>&nbsp;</div>
<div><font face="Arial" size="2">R.K.</font></div>
</blockquote>
</body>
</html>

--------------040407010604050501030203--

Kornelije Rabuzin

unread,
May 21, 2004, 5:18:20 AM5/21/04
to

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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majo...@postgresql.org)

Kornelije Rabuzin

unread,
May 21, 2004, 5:19:12 AM5/21/04
to

thanks ....

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

so, thanks ...

best regards


Kornelije

---------------------------(end of broadcast)---------------------------

0 new messages