Table of contents

BIT_XOR routine - Returns result of XOR operation on input values

The BIT_XOR routine runs a bitwise logical EXCLUSIVE OR operation on the values in input1 with input2 and returns the result.

Syntax

Read syntax diagramSkip visual syntax diagramUTL_RAW.BIT_XOR( input1,input2)

Parameters

input1
An input argument of type VARBINARY(256) that specifies the FIRST value to the XOR operation.
input2
An input argument of type VARBINARY(256) that specifies the SECOND value to the XOR operation.

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_XOR operation:
db2 “select sysibmadm.utl_raw.bit_xor(input1,input2) from sample”

1          
-----------
          x'03033232'
          x'07073434'

  2 record(s) selected.