Re: Converting to number with given format - Mailing list pgsql-general

From Ken Tanzer
Subject Re: Converting to number with given format
Date
Msg-id CAD3a31WSEFd2MUjznsPiK5REorJ_f_Dddw=iMfnVZP9-a2PvWA@mail.gmail.com
Whole thread Raw
In response to Re: Converting to number with given format  (Gabriel Furstenheim Milerud <furstenheim@gmail.com>)
Responses Re: Converting to number with given format  (Gabriel Furstenheim Milerud <furstenheim@gmail.com>)
List pgsql-general
On Wed, Sep 19, 2018 at 6:34 AM Gabriel Furstenheim Milerud <furstenheim@gmail.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
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Dylan Luong
Date:
Subject: help with startup slave after pg_rewind
Next
From: bricklen
Date:
Subject: Re: Replicate Tables from SAP (DB2/HANA) to PostgreSQL