일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- Date and Time Functions
- SVN
- Tibero
- String Function and Operators
- Oracle
- 오라클
- 전자정부 표준프레임워크
- MySQL
- HTTP
- 윈도우
- Date and Time Function
- 전자정부표준프레임워크
- Sring Functions and Operators
- 티베로
- 방화벽
- Data and Time Functions
- String Functions and Operators
- String Functions and Date Operators
- Today
- Total
웹이야기
[MySQL] CHAR() 본문
MySQL 문자열 함수와 연산자
CHAR()
-
CHAR(N, ...[USING charset_name])
의 형태
CHAR() interprets each argument N as an integer and returns a string consisting of the characters given by the code values of those integers. NULL value are skipped.
mysql> SELECT CHAR(77, 121, 83, 81, '76');
+-----------------------------+
| CHAR(77, 121, 83, 81, '76') |
+-----------------------------+
| MySQL |
+-----------------------------+
1 row in set (0.00 sec)
mysql> SELECT HEX(CHAR(1, 0)), HEX(CHAR(256));
+-----------------+----------------+
| HEX(CHAR(1, 0)) | HEX(CHAR(256)) |
+-----------------+----------------+
| 0100 | 0100 |
+-----------------+----------------+
1 row in set (0.00 sec)
mysql> SELECT HEX(CHAR(1, 0, 0)), HEX(CHAR(256*256));
+--------------------+--------------------+
| HEX(CHAR(1, 0, 0)) | HEX(CHAR(256*256)) |
+--------------------+--------------------+
| 010000 | 010000 |
+--------------------+--------------------+
1 row in set (0.00 sec)
By deault, CHAR() returns a binary string. To produce a string given character set, use the optional USING clause:
mysql> SELECT CHARSET(CHAR(X'65')), CHARSET(CHAR(X'65' USING utf8));
+----------------------+---------------------------------+
| CHARSET(CHAR(X'65')) | CHARSET(CHAR(X'65' USING utf8)) |
+----------------------+---------------------------------+
| binary | utf8 |
+----------------------+---------------------------------+
1 row in set, 1 warning (0.00 sec)
'D > MySQL' 카테고리의 다른 글
[MySQL] CHARACTER_LENGTH() (0) | 2020.04.08 |
---|---|
[MySQL] CHAR_LENGTH() (0) | 2020.04.08 |
[MySQL] BIT_LENGTH() (0) | 2020.04.08 |
[MySQL] BIN() (0) | 2020.04.08 |
[MySQL] ASCII() (0) | 2020.04.08 |