返回首页

gbase数据、南大通用产品文档:GBase8a数据类型

更新日期:2024年09月11日

GBase 8a MPP Cluster 支持SQL-92 中定义的绝大多数数据类型,同时也支持
SQL99 和SQL2003 中定义的大部分数据类型。
GBase 8a MPP Cluster 支持的数据类型,如下表所示:
表5- 3 数据类型
GBase 8a MPP Cluster 的数据类型
数值型
TINYINT
SMALLINT
INT
BIGINT
FLOAT
DOUBLE
DECIMAL
NUMERIC
字符型
CHAR
VARCHAR
TEXT

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
626
GBase 8a MPP Cluster 的数据类型
二进制类型
BLOB
BINARY
VARBINARY
LONGBLOB
日期和时间型
DATE
DATETIME
TIME
TIMESTAMP
注意:以下数据类型在gcluster 层与gnode 层范围有差异,gcluster 层支持范围较
gnode 支持范围大,建议应用开发中以较小的支持范围为准,便于应用在gcluster
和gnode 层的统一处理。本章节数据类型的范围描述统一为gcluster 和gnode 共
同支持的范围,即以较小的gnode 范围为准。
数据类型
Gcluster 层范围
Gnode 层范围
timestamp
最大值2038-01-19 11:14:07
最小值1970-01-01 08:00:01
最大值2038-01-01 00:59:59
最小值1970-01-01 08:00:01
tinyint
最大值127
最小值-128
最大值127
最小值-127
smallint
最大值32767
最小值-32768
最大值32767
最小值-32767
bigint
最大值9223372036854775807
最小值-9223372036854775806
最大值9223372036854775806
最小值-9223372036854775806

GBA-01EX-0010
错误码
错误标识
错误信息
GBA-01EX-001
ER_EXPRESS_HASH_I
Hash index error:%s

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1713
错误码
错误标识
错误信息
0
NDEX
错误出现原因
hash index error
分析与建议
根据错误信息寻求技术支持

ifx_int8cvdec() 函数将 decimal 类型值转换为 int8 类型值。
语法
mint ifx_int8cvdec(dec_val, int8_val)

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 728 -

dec_t *dec_val;
ifx_int8_t *int8_val;
dec_val
指向 ifx_int8cvdec() 转换为 int8 类型值的 decimal 结构的指针。
int8_val
指向 ifx_int8cvdec() 放置转换的结果处的 int8 结构的指针。

返回代码
0
转换成功。
<0
转换失败。

示例
demo 目录中的文件 int8cdec.ec 包含下列样例程序。
/*
* ifx_int8cvdec.ec *

The following program converts two INT8t types to DECIMALS and displays the results.
*/

#include

EXEC SQL include decimal;
EXEC SQL include "int8.h";

char string1[] = "2949.3829398204382";
char string2[] = "3238299493";
char result[41];

main()
{

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 729 -

mint x;
ifx_int8_t n;
dec_t num;

printf("IFX_INT8CVDEC Sample ESQL Program running.\n\n");

if (x = deccvasc(string1, strlen(string1), #))
{
printf("Error %d in converting string1 to DECIMAL\n", x);
exit(1);
}
if (x = ifx_int8cvdec(#, &n))
{
printf("Error %d in converting DECIMAL1 to INT8\n", x);
exit(1);
}

/* Convert the INT8 to ascii and display it. Note that the digits to the right of the decimal
are truncated in the conversion.
*/

if (x = ifx_int8toasc(&n, result, sizeof(result)))
{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf("String 1 Value = %s\n", string1);
printf(" INT8 type value = %s\n", result);
if (x = deccvasc(string2, strlen(string2), #))
{
printf("Error %d in converting string2 to DECIMAL\n", x);
exit(1);

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 730 -

}
if (x = ifx_int8cvdec(#, &n))
{
printf("Error %d in converting DECIMAL2 to INT8\n", x);
exit(1);
}
printf("String 2 = %s\n", string2);

/* Convert the INT8 to ascii to display value. */

if (x = ifx_int8toasc(&n, result, sizeof(result)))
{
printf("Error %d in converting INT8 to string\n", x);
exit(1);
}
result[40] = '\0';
printf(" INT8 type value = %s\n", result);

printf("\nIFX_INT8CVDEC Sample Program over.\n\n");
exit(0);
}
输出
IFX_INT8CVDEC Sample ESQL Program running.

String 1 Value = 2949.3829398204382
INT8 type value = 2949
String 2 = 3238299493
INT8 type value = 3238299493
IFX_INT8CVDEC Sample Program over.