该语句用来设置当前连接的数据库的字符集编码。
SET NAMES 'charset_name' [COLLATE 'collation_name']
参数 |
描述 |
---|---|
charset_name | 指定字符集 |
collation_name | 指定字符集排序规则。如未指定,则使用字符集默认排序规则。 |
说明
该语句将三个会话系统变量
character_set_client
,
character_set_connection
和
character_set_results
设置为给定的字符集。将
character_set_connection
设置为
charset_name
,将
collation_connection
设置为
charset_name
的默认排序规则。
OceanBase(admin@test)>SET NAMES 'utf8mb4' COLLATE 'utf8mb4_general_ci';
Query OK, 0 rows affected (0.00 sec)
OceanBase(admin@test)>show variables like 'character_set_c%';
+--------------------------+---------+
| Variable_name | Value |
+--------------------------+---------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
+--------------------------+---------+
2 rows in set (0.01 sec)
OceanBase(admin@test)>show variables like 'collation_connection';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
+----------------------+--------------------+
1 row in set (0.05 sec)
OceanBase(admin@test)>SET NAMES 'gbk';
Query OK, 0 rows affected (0.02 sec)
OceanBase(admin@test)>show variables like 'character_set_c%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| character_set_client | gbk |
| character_set_connection | gbk |
+--------------------------+-------+
2 rows in set (0.01 sec)
OceanBase(admin@test)>show variables like 'collation_connection';
+----------------------+----------------+
| Variable_name | Value |
+----------------------+----------------+
| collation_connection | gbk_chinese_ci |
+----------------------+----------------+
1 row in set (0.01 sec)
网页题目:创新互联OceanBase教程:OceanBaseSETNAMES
标题URL:http://www.shufengxianlan.com/qtweb/news15/322065.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联