Modifying text data?

Started by Enrique Arizónabout 24 years ago4 messagesgeneral
Jump to latest
#1Enrique Arizón
e_arizon_benito@yahoo.com

Hi,
I'm trying to modify text fields in an "automatic" way so to be able
for example, to change any 'Canada' substring occurrence with the
UPPER CASE equivalent "CANADA", with the added option 'Canada'
appearing anywhere inside the text field.
While it is very easy to find matching registers by using regular
expresions, (SELECT * from my_table where my_columm ~* 'canada'; in
previous example) I find no way to change them afterwards, but
manually updating each register.

Thanks in advance for any suggestions!

#2Darren Ferguson
darren@crystalballinc.com
In reply to: Enrique Arizón (#1)
Re: Modifying text data?

Check out UPPER() and LOWER() functions these will help you

i.e. upper(canada)
CANADA

i.e. lower(CAnada)
canada

i.e. initcap(canada)
Canada

HTH
Darren Ferguson

On 8 Mar 2002, [ISO-8859-1] Enrique Ariz�n Benito wrote:

Show quoted text

Hi,
I'm trying to modify text fields in an "automatic" way so to be able
for example, to change any 'Canada' substring occurrence with the
UPPER CASE equivalent "CANADA", with the added option 'Canada'
appearing anywhere inside the text field.
While it is very easy to find matching registers by using regular
expresions, (SELECT * from my_table where my_columm ~* 'canada'; in
previous example) I find no way to change them afterwards, but
manually updating each register.

Thanks in advance for any suggestions!

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

http://archives.postgresql.org

#3Jacob Vennervald Madsen
jvm@gopinocchio.com
In reply to: Darren Ferguson (#2)
Re: Modifying text data?

I would guess you will have to make a stored procedure to handle that.

Jacob Vennervald

Show quoted text

-----Original Message-----
From: Enrique Arizón Benito [mailto:e_arizon_benito@yahoo.com]
Sent: 8. marts 2002 11:48
To: pgsql-general@postgresql.org
Subject: [GENERAL] Modifying text data?

Hi,
I'm trying to modify text fields in an "automatic" way so to be able
for example, to change any 'Canada' substring occurrence with the
UPPER CASE equivalent "CANADA", with the added option 'Canada'
appearing anywhere inside the text field.
While it is very easy to find matching registers by using regular
expresions, (SELECT * from my_table where my_columm ~* 'canada'; in
previous example) I find no way to change them afterwards, but
manually updating each register.

Thanks in advance for any suggestions!

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

http://archives.postgresql.org

#4Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Enrique Arizón (#1)
Re: Modifying text data?

On 8 Mar 2002, [ISO-8859-1] Enrique Ariz�n Benito wrote:

Hi,
I'm trying to modify text fields in an "automatic" way so to be able
for example, to change any 'Canada' substring occurrence with the
UPPER CASE equivalent "CANADA", with the added option 'Canada'
appearing anywhere inside the text field.
While it is very easy to find matching registers by using regular
expresions, (SELECT * from my_table where my_columm ~* 'canada'; in
previous example) I find no way to change them afterwards, but
manually updating each register.

Thanks in advance for any suggestions!

You might want to look into pl/perl, soundslike something that'd be easy
to do there.