Re: Is there a function for Converting a Decimal into BINARY ?

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Ow Mun Heng <ow(dot)mun(dot)heng(at)wdc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a function for Converting a Decimal into BINARY ?
Date: 2009-08-28 02:22:50
Message-ID: 4A973F7A.90805@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ow Mun Heng wrote:
> Hi Guys,
>
> Searching the net didn't give me much clues as to how to convert a Decimal
> number into BINARY.
>

well, a decimal number is a fixed point number stored in a modified BCD
format, which optionally can contain a decimal fractional component.

you likely would want to convert it to a INTEGER or BIGINT first, then
cats it to BIT(n) where N is the number of bits you want.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-28 03:13:03 Re: How to simulate crashes of PostgreSQL?
Previous Message Harvey, Allan AC 2009-08-28 02:03:14 Re: Is there a function for Converting a Decimal into BINARY ?