Re: Convert number to string

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Convert number to string
Date: 2015-09-24 08:16:26
Message-ID: 5603B15A.4060804@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/24/2015 1:09 AM, Hengky Liwandouw wrote:
>
> Hi,
>
> I don’t have any idea how can I use postgres function to convert
> series of number (currency) to my own string.
>
> My string : F G H I J K L M N as the replacement for number :
> 1 2 3 4 5 6 7 8 9
>
> Dozens = O
>
> Hundreds = P
>
> Thousands = C
>
> Ten thousands = B
>
> So…
>
> 200 = GP
>
> 2000 = GC
>
> 1150 = FFJO
>
> 30000 = HB
>
> Any idea ?
>

going from FFJO -> 1150 is simple character substitution (assuming
'dozens' actually means tens, and not its traditional meaning of 12s).

going the other way, thats probably a good excuse for a plperl function.

--
john r pierce, recycling bits in santa cruz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2015-09-24 09:35:17 Fwd: Convert number to string
Previous Message Hengky Liwandouw 2015-09-24 08:09:35 Convert number to string