Re: Substitute a Character

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Substitute a Character
Date: 2006-09-06 17:09:12
Message-ID: 20060906170912.GA18152@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Judith <jaltamirano(at)correolux(dot)com(dot)mx> schrieb:

> Hello everybody!! I have a field type text with folios like this:
> A98526
>
> but I want to change de A for a 0 like this: 098526, exists a way to do
> this in a query???

Perhaps something like this:

test=# select regexp_replace('A98526', '^.', '0');
regexp_replace
----------------
098526
(1 row)

http://www.postgresql.org/docs/8.1/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Mair 2006-09-06 17:14:37 Re: Substitute a Character
Previous Message Judith 2006-09-06 16:53:14 Substitute a Character