on 08-25-2014 9:10 AM
Hi All,
Need help.
I need to convert a decimal number, which I am fetching from underlying database, to binary string (composed of 1s and 0s). Is there any conversion option between these data types? Is it implicit or explicit?
Please help. Appreciate your quick response.
Thanks,
Purnima
Hi
Please try below conversion functions.
Also find the below link's for more info.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please Search with below text.
Binary: converting decimal to binary (part 1 of 2) - YouTube
I understand the basics of Decimal to Binary conversion. I could manage a select sql statement for the conversion but this is not supported by IDT (Standard SQl 92) as the statement is Oracle DB specific.
Is there any way we can make below statement DB independent or a combination of functions in IDT which we can use? Even if we can have something at report level for the conversion, it would solve my purpose.
I am using multi-source IDT 4.0 universe.
SELECT DECODE(BITAND(VALUE, 128), 128, '1', '0') ||
DECODE(BITAND(VALUE, 64), 64, '1', '0') ||
DECODE(BITAND(VALUE, 32), 32, '1', '0') ||
DECODE(BITAND(VALUE, 16), 16, '1', '0') ||
DECODE(BITAND(VALUE, 8), 8, '1', '0') ||
DECODE(BITAND(VALUE, 4), 4, '1', '0') ||
DECODE(BITAND(VALUE, 2), 2, '1', '0') ||
DECODE(BITAND(VALUE, 1), 1, '1', '0') AS BIN_NUMBER FROM
(SELECT 12 AS VALUE FROM DUAL) A;
User | Count |
---|---|
86 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.