BIT_COMPLEMENT routine - Returns result of COMPLEMENT operation on input values

The BIT COMPLEMENT operation runs a bitwise logical COMPLEMENT operation against the values in input1 and returns the result.

Syntax

Read syntax diagramSkip visual syntax diagram UTL_RAW.BIT_COMPLEMENT(input1)

Parameters

input1
An input argument of type VARBINARY(256) that specifies the value to be complemented.

Authorization

EXECUTE privilege on the UTL_RAW module.

Examples

Example 1: The following example shows how to set up a table with a VARBINARY data type:
db2 "create table sample(input1 VARBINARY(20) not null, input2 VARBINARY(20) not null)"                
DB20000I  The SQL command completed successfully.
Example 2: The following example shows how to insert data into a table that has a VARBINARY data type:
db2 "insert into sample(input1, input2) values (bx'3131',bx'32323232')"                                   
DB20000I  The SQL command completed successfully.

db2 "insert into sample(input1, input2) values (bx'3333',bx'34343434')"
DB20000I  The SQL command completed successfully.
Example 3: The following example shows how to run a BIT_COMPLEMENT operation:
db2 "select sysibmadm.utl_raw.bit_complement(input1) from sample"

1          
-----------
          x’CECE’
          x’CCCC’

  2 record(s) selected.