|
|
Archives of the TeradataForum
Message Posted: Thu, 09 Oct 2003 @ 19:48:43 GMT
Subj: | | Re: Bitwise operations |
|
From: | | Dieter Noeth |
Figge, Jason wrote:
| Does anyone know if Teradata can perform bitwise operations? | |
| (x & 1) = 1
(x & 2) = 2
(x & 4) = 4 | |
| case when x in (1,3,5,7,9) then 1 else 0 end
case when x in (2,3,6,7) then 2 else 0 end
case when x in (4,5,6,7) then 4 else 0 end | |
| but this implies a closed world assumption and it's a little too
restrictive for my liking | |
If it's only a single bit:
x / 1 mod 2 * 1
x / 2 mod 2 * 2
x / 4 mod 2 * 4
If you only want to know if that bit is set:
x / 1 mod 2
x / 2 mod 2
x / 4 mod 2
Dieter
| |