hi guys i need help, converting from number to binary in oracle 9i. any one!!!!
Convert from Number to binary
Collapse
X
-
-
what a shame no one could do it.thats the answer boys...
FUNCTION dec_to_bin (decin IN NUMBER)
RETURN VARCHAR2
IS
v_decin NUMBER;
v_next_digit NUMBER;
v_result VARCHAR (2000);
BEGIN
v_decin := decin;
WHILE v_decin > 0
LOOP
v_next_digit := MOD (v_decin, 2);
v_result := TO_CHAR (v_next_digit) || v_result;
v_decin := FLOOR (v_decin / 2);
END LOOP;
RETURN v_result;
END dec_to_bin;
Comment