返回首页

gbase数据、南大通用产品文档:GBase8aLOAD_FILE(file_name)

更新日期:2024年09月11日

函数说明
读取文件并将这一文件按照字符串的格式返回。若文件不存在,或不能被读取,
则函数返回值为NULL。
示例
示例1:读取a.txt 文件,并返回内容。
gbase> SELECT LOAD_FILE('/home/gbase/a.txt') FROM dual;
+--------------------------------+
| LOAD_FILE('/home/gbase/a.txt') |
+--------------------------------+
| adfdfafgagsdgewr
|
+--------------------------------+
1 row in set

语法格式
DELETE [FROM] [vc_name.][database_name.]table_name [tbl_alias] [WHERE
where_definition]
表5- 95 参数说明
参数名称


vc_name
虚拟集群名,可选项。
database_name
数据库名,可选项。
table_name
表名,是要被插入数据的表。
tbl_alias
别名
说明

当DELETE 语句中包含别名时,可以省略FROM 关键字。
示例
示例中用到的表及数据:
CREATE TABLE t0 (id int);
INSERT INTO t0 values(1),(2),(3),(4),(5),(6),(7),(8);
示例1:删除表中id 大于6 的数据。
gbase> DELETE FROM t0 WHERE t0.id > 6;
Query OK, 2 rows affected
示例2:使用IN,删除id 值为1,2,3 的数据。
gbase> DELETE FROM t0 WHERE t0.id IN ( 1,2,3);
Query OK, 3 rows affected
示例3:删除全表数据。
gbase> DELETE FROM t0;
Query OK, 3 rows affected
示例4:DELETE FROM...WHERE...IN (SELECT...FROM)。
gbase> INSERT INTO t0 values(1),(2),(3),(4),(5),(6),(7),(8);
Query OK, 8 rows affected

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1063
Records: 8
Duplicates: 0
Warnings: 0
gbase> DELETE FROM t0 WHERE t0.ID IN (SELECT id FROM t0);
Query OK, 8 rows affected
示例5:DELETE 语法中包含表的别名,可以省略FROM 关键字。
gbase> INSERT INTO t0 values(1),(2),(3),(4),(5),(6),(7),(8);
Query OK, 8 rows affected
Records: 8
Duplicates: 0
Warnings: 0
gbase> DELETE FROM t0 tt WHERE tt.id=8;
Query OK, 1 row affected
gbase> DELETE t0 tt WHERE tt.id=1;
Query OK, 1 row affected
gbase> SELECT * FROM t0;
+------+
| id
|
+------+
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
+------+
6 rows in set
示例6:DELETE ...WHERE...
gbase> DELETE t0 WHERE id = 2;
Query OK, 1 row affected

步骤1
安装透明网关,解压tar 包
tar -xvf [安装包]
步骤2
修改透明网关相应权限:
chmod -R +x [安装目录]
步骤3
配置透明网关,修改系统参数配置文件:[安装目录]/conf/conf.properties,修改内容
如下:
$ cat conf.properties
gbase.gt.port=9898
gbase.gt.encode=utf-8
gbase.gt.pagesize=10000
gbase.gt.load.data.type=0
gbase.gt.gc.paging.query=1
gbase.gt.wait.timeout=7200
步骤4
修改网关数据源配置文件:
[安装目录]/conf/datasource/gc_link1.properties,
内容如下:
$ cd [安装目录]/conf/datasource/

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
601
$ cp sample/gbase_link1.properties
gc_link1.properties
$ cat dataSource/gc_link1.properties
[gbase8a cluster]
dataSource_IP=[数据源IP]
dataSource_port=5258
dataSource_dbname=[数据源的库名]
dataSource_dbtype=gcluster
dataSource_user=gbase
dataSource_pwd=******
步骤5
修改网关目标数据库配置文件:
[安装目录]/conf/gcluster/gbase8a_gcluster.properties,
内容如下:
$ cat gcluster/gbase8a_gcluster.properties
[gc1]
gcluster_IP=192.168.146.20
gcluster_port=5258
gcluster_encode=utf-8
gcluster_user=gbase
gcluster_pwd=******
步骤6
启动透明网关
$ cd [安装目录]
$ sh gt.sh
步骤7
透明网关关闭方式,如果透明网关配置失败需要手动kill 对应的进程号,然后重
新启动
ps -ef|grep GBaseGateway
kill [进程号]