number to binary conversion

2001-06-14 Thread Steve Haas
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 o

RE: number to binary conversion

2001-06-14 Thread Larry Elkins
n 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. > D

Re: number to binary conversion

2001-06-14 Thread Igor Neyman
Here is my modification of Tom's Kyte code: FUNCTION to_base( p_dec in number, p_base in number ) return varchar2 is l_str varchar2(255) default NULL; l_num number default p_dec; l_hex varchar2(16) default '0123456789ABCDEF'; begin if ( trunc(p_dec) <> p_dec ) then raise PROGRAM_ERROR; end if

Re: number to binary conversion

2001-06-15 Thread Connor McDonald
Simple one attached...Handles up to 32bits, and I could squeeze about 3000 conversions per second out of my laptop with it. Cheers Connor create or replace package conv is function to_binary(p_in number) return varchar2; function from_binary(p_in varchar2) return number; end; / create or re