View previous topic :: View next topic |
Author |
Message |
manojagrawal Beginner
Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Thu Apr 24, 2003 8:07 am Post subject: SELECT for viewing Bit data |
|
|
Hi,
I have a field which is of type CHAR(32)
This field contains data which in which each individual bit represents something. What i want to do is run a SQL query to see the individual bits. I am not able to find any function for this. Any idea's?
Regards,
Manoj. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Apr 24, 2003 10:14 am Post subject: |
|
|
Manoj,
I guess you meant each individual character instead of bit. You can use SUBSTR function with a case to validate each byte.
Code: |
SELECT (CASE SUBSTR(COLA,1,1)
WHEN 'A' THEN 'FIRST ALPHABET'
ELSE 'UNKNOWN'
END),
(CASE SUBSTR(COLA,2,1)
WHEN 'B' THEN 'SECOND ALPHABET'
ELSE 'UNKNOWN'
END)
.....
(CASE SUBSTR(COLA,32,1)
WHEN 'B' THEN 'SECOND ALPHABET'
ELSE 'UNKNOWN'
END)
FROM TABLENAME WHERE COND1 = 'BLAH'
;
|
The above code validates the 1st character of the COLA and if it is 'A' then it prints as 'FIRST ALPHABET' else it will print 'UNKNOWN'
This is the same for all the 32 characters.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
|
manojagrawal Beginner
Joined: 25 Feb 2003 Posts: 124 Topics: 29
|
Posted: Thu Apr 24, 2003 11:26 pm Post subject: |
|
|
Hi Kolusu,
What I meant was each BIT. Thus the 32 char field would have 32*8=256 bits.
I would like to see the individual bits using a SELECT. Is this possible???
Regards,
Manoj. |
|
Back to top |
|
|
Premkumar Moderator
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
|
Back to top |
|
|
|
|