:meta-keywords: CUBRID bitwise operator, cubrid bit_and, cubrid bit_or, cubrid bit_xor, cubrid bit_count
:meta-description: A Bitwise operator performs operations in bits, and can be used in arithmetic operations.
:tocdepth: 3
***************************
BIT Functions and Operators
***************************
.. contents::
Bitwise Operator
================
A **Bitwise** operator performs operations in bits, and can be used in arithmetic operations. An integer type is specified as the operand and the **BIT** type cannot be specified. An integer of **BIGINT** type (64-bit integer) is returned as a result of the operation. If one or more operands are **NULL**, **NULL** is returned.
The following table shows the bitwise operators supported by CUBRID.
**The bitwise operators**
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| Bitwise operator | Description | Expression | Return Value |
+======================+================================================================================================================================================+================+================+
| & | Performs AND operation in bits and returns a BIGINT integer. | 17 & 3 | 1 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| \| | Performs OR operation in bits and returns a BIGINT integer. | 17 \| 3 | 19 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| ^ | Performs XOR operation in bits and returns a BIGINT integer. | 17 ^ 3 | 18 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| ~ | A unary operator. It performs complementary operation that reverses (INVERT) the bit order of the operand and returns a BIGINT integer. | ~17 | -18 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| << | Performs the operation to shift bits of the left operand as far to the left as the value of the right operand, and returns a BIGINT integer. | 17 << 3 | 136 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
| >> | Performs the operation to shift bits of the left operand as far to the right as the value of the right operand, and returns a BIGINT integer. | 17 >> 3 | 2 |
+----------------------+------------------------------------------------------------------------------------------------------------------------------------------------+----------------+----------------+
BIT_AND
=======
.. function:: BIT_AND (expr)
As an aggregate function, it performs **AND** operations in bits on every bit of *expr*. The return value is a **BIGINT** type. If there is no row that satisfies the expression, **NULL** is returned.
:param expr: An expression of integer type
:rtype: BIGINT
.. code-block:: sql
CREATE TABLE bit_tbl(id int);
INSERT INTO bit_tbl VALUES (1), (2), (3), (4), (5);
SELECT 1&3&5, BIT_AND(id) FROM bit_tbl WHERE id in(1,3,5);
::
1&3&5 bit_and(id)
============================================
1 1
BIT_OR
======
.. function:: BIT_OR (expr)
As an aggregate function, it performs **OR** operations in bits on every bit of *expr*. The return value is a **BIGINT** type. If there is no row that satisfies the expression, **NULL** is returned.
:param expr: An expression of integer type
:rtype: BIGINT
.. code-block:: sql
SELECT 1|3|5, BIT_OR(id) FROM bit_tbl WHERE id in(1,3,5);
::
1|3|5 bit_or(id)
============================================
7 7
BIT_XOR
=======
.. function:: BIT_XOR (expr)
As an aggregate function, it performs **XOR** operations in bits on every bit of *expr*. The return value is a **BIGINT** type. If there is no row that satisfies the expression, **NULL** is returned.
:param expr: An expression of integer type
:rtype: BIGINT
.. code-block:: sql
SELECT 1^2^3, BIT_XOR(id) FROM bit_tbl WHERE id in(1,3,5);
::
1^3^5 bit_xor(id)
============================================
7 7
BIT_COUNT
=========
.. function:: BIT_COUNT (expr)
The **BIT_COUNT** function returns the number of bits of *expr* that have been set to 1; it is not an aggregate function. The return value is a **BIGINT** type.
:param expr: An expression of integer type
:rtype: BIGINT
.. code-block:: sql
SELECT BIT_COUNT(id) FROM bit_tbl WHERE id in(1,3,5);
::
bit_count(id)
================
1
2
2
Day widened into its first perfection as we moved down the highroad toward a near fork whose right was to lead Harry and his solemn cortége southward, while the left should be our eastward course. Camille and I rode horseback, side by side, with no one near enough to smile at my sentimental laudations of the morning's splendors, or at her for repaying my eloquence with looks so full of tender worship, personal acceptance and self-bestowal, that to tell of them here would make as poor a show as to lift a sea-flower out of the sea; they call for piccolo notes and I am no musician. The little man elected to have a cab. When Bow Street was reached Prout had the satisfaction of finding that all his birds had been netted. He received the warm congratulations of his inspector modestly. Caloric or air engines. I did not feel very comfortable after what had happened to those soldiers who lost their lives so cruelly sudden, or in any case had been seriously wounded, while the officers took little notice of them. But it was desirable to behave as discreetly as possible, and so to get a permit to Maastricht. "Louvain, “It will check up, that way, too,” smiled Larry. "Me run away," thought Shorty, as they walked along. "Hosses couldn't drag me away. I only hope that house is 10 miles off." Reuben began to take off his coat—young Realf drew back almost in disgust. "Well, would Robert have stolen money, or Albert disgraced your name, to get free, if you and your farm hadn't made them slaves? If you hadn't been a heartless slave-driver would George have died the other night alone on the Moor?—or would Richard have taken advantage of a neighbour's charity to escape from you? Don't you see that your ambition has driven you to make slaves of your children?" "D?an't tell me," said Coalbran in the bar, "as it wurn't his fault. Foot-and-mouth can't just drop from heaven. He must have bought some furriners, and they've carried it wud 'em, surelye." But meantime a strange restlessness consumed her, tinctured by a horrible boldness. There were moments when she no longer was afraid of Handshut, when she felt herself impelled to seek him out, and make the most of the short time they had together. There could be no danger, for he was going so soon ... so few more words, so few more glances.... Thus her mind worked. "What mean you, woman?" quickly returned De Boteler; "do you accuse the keeper of my chase as having plotted against your son, or whom do you suspect?" Her face was shrivelled and yellow, and the dark full eyes that now, as it were, stood forth from the sunken cheeks, looked with a strange brightness on the scene, and seemed well adapted to stamp the character of witch on so withered a form. And perhaps there were few of those entirely uninterested in the matter who now gazed upon her, who would not have sworn that she merited the stake. "Thou art set over the people, and to the Lord's anointed I come to seek for justice." HoME欧美一级毛片免费高清日韩
ENTER NUMBET 0018www.b035.com.cn
feizaojv.com.cn
jhdfzy.com.cn
www.lefd.com.cn
www.aimibb.com.cn
www.jkgtyy.com.cn
www.51axz.com.cn
kinye.com.cn
www.bjhyjx.net.cn
kmpaige.com.cn