Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: number to binary conversion

RE: number to binary conversion

From: Larry Elkins <elkinsl_at_flash.net>
Date: Thu, 14 Jun 2001 13:17:16 -0700
Message-ID: <F001.0032A2AB.20010614133332@fatcity.com>

Steven,

For decimal to hex, a to_char function using the "X" element can be used. There are certain restrictions -- refer to the Number Formats table in the SQL manual for more info. Here is an example:

  1* select to_char(10,'XXX') from dual
SQL> / TO_C


   A

For a more robust solution that goes both ways, and, deals with conversions between various bases, take a look at:

http://govt.oracle.com/~tkyte/hexdec/index.html

Regards,

Larry G. Elkins
elkinsl_at_flash.net
> -----Original Message-----
> From: root_at_fatcity.com [mailto:root_at_fatcity.com]On Behalf Of Steve Haas
> Sent: Thursday, June 14, 2001 4:02 PM
> To: Multiple recipients of list ORACLE-L
> Subject: number to binary conversion
>
>
> Good afternoon,
>
> I have seen on this list some time ago PL/SQL to convert a number to/from
> decimal and hex.
> Does anyone have PL/SQL to convert a number to/from a binary
> representation?
>
> TIA,
>
> Steven Haas
> Opus Consultants, LLC
> "Opinions expressed, right or wrong, are my own."

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Larry Elkins
  INET: elkinsl_at_flash.net

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Jun 14 2001 - 15:17:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US