Bitwise Logical Functions

Use the bitwise logical functions to perform named bit operations.
(1)
Bitwise Logical Functions

1 1
1 
2.1 BITAND
2.1 BITOR
2.1 BITXOR
2.1 BITANDNOT
1  ( int8_expr , int8_expr )
1  BITNOT ( int8_expr )
Notes:
  • 1 HCL OneDB™ extension
Element Description Restrictions Syntax
int8_expr Number expression that can be converted to an INT8 value For BITNOT the maximum size is reduced by 1 Expression

The arguments to these functions can be any numeric data type that can be converted to the INT8 data type.

Except for BITNOT, which takes a single argument, these bitwise logical functions take two arguments that can be converted to an INT8 value.

If both arguments have the same integer types, the data type of the returned value is the same type as the arguments. If the two arguments are of different integer types, the returned value is the integer type with the greater precision. For example, if the first argument is of type INT, and the second argument is of type INT8, the returned value is of type INT8.

If the arguments are any other numeric type, such as DECIMAL, SMALLFLOAT, FLOAT, or MONEY, or some combination of those types, the returned data type is DECIMAL(32).

If using host variables, and the data types of the arguments are not known at prepare time, the data type INTEGER is assumed for both arguments, and the returned value is INTEGER. If, after prepare, at execution time, a different data type value is supplied for the host variable, HCL OneDB issues a -9750 error. To prevent such an occurrence, you can specify the host variable data type by using a cast, as in the following ESQL/C program fragment:
sprintf(query1, “, 
   bitand(  ?::int8,  ?::int8) from mytab”);
EXEC SQL prepare selectq from :query;
EXEC SQL declare select_cursor cursor for selectq;
EXEC SQL open select_cursor 
   using :hostvar_int8_input1, :hostvar_int8_input2;
	
EXEC SQL fetch select_cursor into :var_int8_output;