返回首页

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

更新日期:2024年09月11日

返回一对表达式的总体协方差。 返回的结果为double 数据类型。
语法
COVAR_POP( expression1, expression2)
参数说明
必须指定两个参数表达式,expression1 和expression2 须为数值表达式。
注意
COVAR_POP 函数计算将忽略 expression1 或 expression2 为NULL 值的记录。
示例
示例:
create table all_tables(owner int, avg_row_len int, avg_space int);

insert into all_tables values(1, 1241, 2446);
insert into all_tables values(1, 1158, 1028);
insert into all_tables values(1, 332, 621);
insert into all_tables values(1, 126, 408);
insert into all_tables values(1, 173, 1222);
insert into all_tables values(1, 180, 834);
insert into all_tables values(1, 96, 702);
insert into all_tables values(1, 285, 158);
insert into all_tables values(1, null, 159);
insert into all_tables values(1, 190, null);
insert into all_tables values(1, null,null);
insert into all_tables values(2, 1, 2);
insert into all_tables values(2, 3, 4);
insert into all_tables values(2, 5, 6);
gbase> select owner,covar_pop(avg_row_len,
avg_space)
from all_tables group by owner;
+-------+-----------------------------------+
| owner | covar_pop(avg_row_len, avg_space) |
+-------+-----------------------------------+
| 2 | 2.66666667 |
| 1 | 203404.29687500 |

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 569
+-------+-----------------------------------+
2 rows in set




(String,
String,
GBaseParameter[])
对GBase 数据库执行一句SQL 命令,方法执行期间,一个新的
GBaseConnection 对象会被创建、打开和关闭。通过GBaseParameter[]参数传
递命令对象使用的参数。

语法
[Visual Basic]
Public Shared Function ExecuteReader ( _

connectionString As String, _

commandText As String, _

ParamArray commandParameters As GBaseParameter() _
) As GBaseDataReader
[C#]
public static GBaseDataReader ExecuteReader(

string connectionString,

string commandText,



GBase 8a 程序员手册ADO.NET 篇
南大通用数据技术股份有限公司

- 267 -

params GBaseParameter[] commandParameters
)

参数
1) connectionString :用于创建GBaseConnection 对象的连接字符串;

2) commandText :要执行的SQL 语句;
3) commandParameters :用于GBaseCommand 对象的参数数组。


返回值
准备读取命令结果的GBaseDataReader 对象。

orato8a 简介
orato8a 是一个可以快速、
高效地从oracle 数据库系统中抽取数据,
并将数据保存到
指定文件或直接迁移到GBase 8a MPP Cluster 中的专用工具。
orato8a 还提供查询语
句导出和全表导出两种方式,其中全表导出的登录用户需要对oracle 数据库中的
dba_extents、dba_objects 和dba_tables 这三张表有select 权限。
orato8a 部署
orato8a 是一个独立运行的数据抽取工具,需要将此工具部署在可以访问到oracle
的机器上(即需要与oracle 客户端部署在一起),或者直接与oralce server 部署在
一台服务器上。
orato8a 安装包以tar.bz2 的压缩格式提供。例如:
orato8a_26794_Redhat6.2_x86_64.tar.bz2。
解压后,将会在解压目录下产生一个orato8a 的可执行程序文件。
# tar xfj orato8a_26794_Redhat6.2_x86_64.tar.bz2
$ ll

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
130
总用量2068
……
-rw-r--r-- 1 root root 1380535
8 月23 01:08 orato8a
orato8a 语法
./orato8a parameter_1 parameter_2 …… parameter_n
说明
执行orato8a 的用户,必须是有权限访问oracle 数据库的用户。orato8a 导出oracle 中blob
或clob 类型数据列时不同的orato8a 版本有不同的参数控制,
需要根据具体版本参考手册处
理。
orato8a 示例
$ ./orato8a --user='ct1/ct1ct1@orcl' --query="select LO_ORDERKEY, LO_LINENUMBER
FROM lineorder_test" --file='/opt/orato8a_output/lineorder.txt ' --field=";" --format=3
export columns: 2
export rows: 10
export time: 0 sec
process ok!