Re: Converting to number with given format

From: Gabriel Furstenheim Milerud <furstenheim(at)gmail(dot)com>
To: ken(dot)tanzer(at)gmail(dot)com
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting to number with given format
Date: 2018-09-20 15:21:07
Message-ID: CAJN3DWrtoy35jRsK3XWu85emzhCsQFjyDpHJ62wNMqH95fez2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ken,
Thanks a lot, that's a cool idea and I think that it will cover my needs.

On Thu, 20 Sep 2018 at 02:04, Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> wrote:

> On Wed, Sep 19, 2018 at 6:34 AM Gabriel Furstenheim Milerud <
> furstenheim(at)gmail(dot)com> wrote:
>
> Maybe that is not possible with numbers? To say in a format something like
>> "my numbers have comma as decimal separator and no thousands separators" or
>> "my numbers are point separated and have comma as thousands separator"
>>
>>
> Would stripping out the thousand separator, and leaving in the decimal
> separator work?
>
> SELECT replace('9,000.34',',','')::numeric;
> replace
> ---------
> 9000.34
>
> If so, then (conceptually) does this work?
>
> SELECT replace(
>
> replace(my_numeric_string, user_thousand_sep, ''),
>
> user_decimal_sep, system_decimal_sep
>
> )::numeric
>
>
> Or maybe I'm missing something about this!
>
> Cheers,
>
> Ken
>
>
>
> --
> AGENCY Software
> A Free Software data system
> By and for non-profits
> *http://agency-software.org/ <http://agency-software.org/>*
> *https://demo.agency-software.org/client
> <https://demo.agency-software.org/client>*
> ken(dot)tanzer(at)agency-software(dot)org
> (253) 245-3801
>
> Subscribe to the mailing list
> <agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
> learn more about AGENCY or
> follow the discussion.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2018-09-20 16:29:07 Re: Advice on machine specs for growth
Previous Message Chris Travers 2018-09-20 15:20:55 Re: Code of Conduct