Bruce Momjian <pgman@candle.pha.pa.us> writes:

> Chandra Sekhar Surapaneni wrote:
> > Hi All,
> >   Is there a built in function which works exactly the opposite way as
> > to_hex(). 
> > I basically want to convert a a hexadecimal to a decimal. 
> 
> Sure:
>       
>       test=> SELECT x'10'::integer;
>        int4
>       ------
>          16
>       (1 row)

That's not the inverse of to_hex().  to_hex() takes an integer and
returns text.  You've taken the bitstring constant B'10000' and
coerced it to integer.  The inverse funtion would take the text '10'
and return the integer 16.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to