Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello guys,
Don't know whether right place to ask this question or not. Do help if possible.
I have a list of below distinct values in SOURCE field.
SOURCES |
100 |
110 |
1000 |
1010 |
1100 |
1110 |
10000 |
10010 |
100100 |
100110 |
When i check database what these values represents to, comment is available for this field in oracle DB as "Set as a bit INDEX: 0 = U, 1 = A, 2 = S, 3 = R, 4 = AA, 5 = SS.
I got confirmation for some of values what does those means as below, however i cannot understand what will be the combination of sources for remaining binary numbers. (1000, 1010, 1100, 1110, 10000, 10010, 100100)
SOURCE | Representation | |
100 | S | 2 |
110 | A+S | 1+2 |
1000 | ||
1010 | ||
1100 | ||
1110 | ||
10000 | ||
10010 | ||
100100 | ||
100110 | A+S+SS | 1+2+5 |
I have gone though the binary number concepts, but not sure for final results.
Anyone can help how can we know this ?
Thanks alot.
Bits (or flags if you like) in this bit mask are right-aligned and numbered from right to left, e.g. b5b4b3b2b1b0.
Fifth row
b5b4b3b2b1b0
0 0 1 1 0 0
means bit 3 (R) and bit 2 (S) are set.
This will unpack the binary index:
If(SOURCE bitand 1, 'U ', '') &
If(SOURCE bitand 2, 'A ', '') &
If(SOURCE bitand 4, 'S ', '') &
If(SOURCE bitand 8, 'R ', '') &
If(SOURCE bitand 16, 'AA ', '') &
If(SOURCE bitand 32, 'SS ', '') As Index
To use + as a spacer and to remove the trailing +:
Replace(
Trim(
If(SOURCE bitand 1, 'U ', '') &
If(SOURCE bitand 2, 'A ', '') &
If(SOURCE bitand 4, 'S ', '') &
If(SOURCE bitand 8, 'R ', '') &
If(SOURCE bitand 16, 'AA ', '') &
If(SOURCE bitand 32, 'SS ', '')
)
, ' ', '+'
) As Index
Bits (or flags if you like) in this bit mask are right-aligned and numbered from right to left, e.g. b5b4b3b2b1b0.
Fifth row
b5b4b3b2b1b0
0 0 1 1 0 0
means bit 3 (R) and bit 2 (S) are set.
Thanks for response.
I can create new field like
If(Source=100, DUAL('S',100), |
If(Source=110, DUAL('A+S',110),
If(Source=100110, DUAL('A+S+SS',100110) | as Source, |
Here if i know remaining values to represents to what combination of source, then it would be helpful.
Wow, it seams you are right. Thanks peter.
I think i will get like this ... Thanks alot.
SOURCE | Representation | |
100 | S | 2 |
110 | A+S | 1+2 |
1000 | R | 3 |
1010 | A+R | 1+3 |
1100 | S+R | 2+3 |
1110 | A+S+R | 1+2+3 |
10000 | AA | 4 |
10010 | A+AA | 1+4 |
100100 | S+SS | 2+5 |
100110 | A+S+SS | 1+2+5 |