Bitwise operators on Informix-SQL
Posted in 1999
Topics: SQL Development & Query Writing, Platform-Specific Issues
I have to perform a bitwise comparison (and) between two integer numbers
inside a SQL query on a Informix DB (ver. 5.01 and 7.1), SO HP-UX 9.04. I
would appreciate help, because the system doesn't accept these kinds of
statement:
select count(*) from table where (field1 and integer) <> 0<syntax error>
select count(*) from table where (field1 & integer) <> 0 <illegalcharacter>
Regards
Lucabond
lucabond@freemail.it
Lucabond wrote:
>
> I have to perform a bitwise comparison (and) between two integer numbers
> inside a SQL query on a Informix DB (ver. 5.01 and 7.1), SO HP-UX 9.04. I
> would appreciate help, because the system doesn't accept these kinds of
> statement:
>
> select count(*) from table where (field1 and integer) <> 0> <syntax error>
> select count(*) from table where (field1 & integer) <> 0 <illegal> character>
There should be the stored procedure bitval( bitset, bitmask ) in
sysmaster you can use that procedure to filter bits, towit:
select count(*) from table where sysmaster:bitval( field1, 8 ) = 1;
Art S. Kagel