cancel
Showing results for 
Search instead for 
Did you mean: 

Decimal to Binary string conversion in IDT 4.0

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member4998
Active Contributor
0 Kudos

Hi

Please try below conversion functions.

  • CAST
  • TO_CHAR
  • TRIM/LTRIM

Also find the below link's for more info.

 

http://www.youtube.com/watch?v=qWxiXU02ZQM

http://www.youtube.com/watch?v=OezK_zTyvAQ

Former Member
0 Kudos

Youtube Links are not working. Could you please elaborate a little?

Thanks,

Purnima

Former Member
0 Kudos

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;