Oracle 5.0 Reference Manual page 971

Table of Contents

Advertisement

Name
[951]
|
[951]
^
[951]
<<
[951]
>>
MySQL uses
(64-bit) arithmetic for bit operations, so these operators have a maximum range
BIGINT
of 64 bits.
[951]
|
Bitwise OR:
mysql>
SELECT 29 | 15;
-> 31
The result is an unsigned 64-bit integer.
[951]
&
Bitwise AND:
mysql>
SELECT 29 & 15;
-> 13
The result is an unsigned 64-bit integer.
[951]
^
Bitwise XOR:
mysql>
SELECT 1 ^ 1;
-> 0
mysql>
SELECT 1 ^ 0;
-> 1
mysql>
SELECT 11 ^ 3;
-> 8
The result is an unsigned 64-bit integer.
[951]
<<
Shifts a longlong (BIGINT) number to the left.
mysql>
SELECT 1 << 2;
-> 4
The result is an unsigned 64-bit integer. The value is truncated to 64 bits. In particular, if the shift
count is greater or equal to the width of an unsigned 64-bit number, the result is zero.
[951]
>>
Shifts a longlong (BIGINT) number to the right.
mysql>
SELECT 4 >> 2;
-> 1
The result is an unsigned 64-bit integer. The value is truncated to 64 bits. In particular, if the shift
count is greater or equal to the width of an unsigned 64-bit number, the result is zero.
[951]
~
Invert all bits.
Bit Functions
Description
Bitwise OR
Bitwise XOR
Left shift
Right shift
951

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents