SQL Language Guide : 4. Elements of SQL Statements : SQL Functions : Bitwise Functions
 
Share this page                  
Bitwise Functions
Vector bitwise functions operate only on IPV4 and IPV6 addresses.
BIT_AND
BIT_AND(expr, expr)
Operand type: IPV4 or IPV6 addresses
Result type: Same as operands
Returns the logical AND of the two operands.
SELECT BIT_AND(IPV4('255.255.255.0'),IPV4('172.16.254.1'))
returns (as an IPv4)
172.16.254.0
BIT_NOT
BIT_AND(expr)
Operand type: IPV4 or IPV6 addresses
Result type: Same as operand
Returns the logical NOT of the operand.
SELECT BIT_NOT(IPV4('172.16.254.1'))
returns (as an IPv4):
83.239.1.254
BIT_OR
BIT_OR(expr, expr)
Operand type: IPV4 or IPV6 addresses
Result type: Same as operands
Returns the logical OR of the two operands.
SELECT BIT_OR(IPV4('255.255.255.0'),ipv4('172.16.254.1'))\g 
returns (as an IPv4):
255.255.255.1
BIT_XOR
BIT_XOR(expr, expr)
Operand type: IPV4 or IPV6 addresses
Result type: Same as operands
Returns the logical XOR of the two operands.
SELECT BIT_XOR(IPV4('255.255.255.0'),IPV4('172.16.254.1'))
returns (as an IPv4)
83.239.1.1