Re: Is there a function for Converting a Decimal into BINARY ? - Mailing list pgsql-general

From John R Pierce
Subject Re: Is there a function for Converting a Decimal into BINARY ?
Date
Msg-id 4A973F7A.90805@hogranch.com
Whole thread Raw
In response to Is there a function for Converting a Decimal into BINARY ?  ("Ow Mun Heng" <ow.mun.heng@wdc.com>)
List 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.

pgsql-general by date:

Previous
From: "Ow Mun Heng"
Date:
Subject: Is there a function for Converting a Decimal into BINARY ?
Next
From: "Harvey, Allan AC"
Date:
Subject: Re: Is there a function for Converting a Decimal into BINARY ?