Hitachi

Hitachi Advanced Database SQL Reference


8.11.3 BITNOT

Returns the bitwise logical NOT of a binary data item.

Organization of this subsection

(1) Specification format

scalar-function-BITNOT ::= BITNOT(target-data)
 
  target-data ::= value-expression

(2) Explanation of specification format

target-data:

Specifies the target binary data.

The following rules apply:

  • Specify the target data in the form of a value expression. For details about value expressions, see 7.20 Value expression.

  • Specify BINARY or VARBINARY type data for the target data.

  • You cannot specify a dynamic parameter by itself for the target data.

The following example illustrates the result of executing the scalar function BITNOT.

Examples:

Return the bitwise logical NOT of a binary data item.

BITNOT (B'01011011')B'10100100'

BITNOT (B'11010001')B'00101110'

BITNOT (X'0F')X'F0'

(3) Rules

  1. The data type and data length of the execution result will be the data type and data length of the target data.

  2. The NOT NULL constraint does not apply to the value of the execution result (the null value is allowed).

  3. If the target data has a null value, the execution result will be a null value.

  4. If the target data is binary data whose actual length is 0 bytes, the execution result will be binary data whose actual length is 0 bytes.

  5. The execution result of the scalar function BITNOT (value of the nth bit) is shown in the following table.

    Table 8‒38: Execution result of the scalar function BITNOT (value of the nth bit)

    Value of the nth bit of the target data

    Execution result of the scalar function BITNOT (value of the nth bit)

    0

    1

    1

    0