返回首页

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

更新日期:2024年09月11日

函数说明
返回几何点的y 位置。
返回值类型:DOUBLE。
示例:
gbase> SELECT GB_Y(GB_GeometryFromChar('POINT (5 4)')) from dual;
+------------------------------------------+
| GB_X(GB_GeometryFromChar('POINT (5 4)')) |
+------------------------------------------+
|
4
|
+------------------------------------------+
1 row in set

COLLATION(str)
函数说明
返回字符串参数的字符集排序规则。
示例
示例1:返回“abc”的字符集排序规则。
gbase> SELECT COLLATION('abc') FROM dual;
+--------------------+
| COLLATION('abc')
|
+--------------------+
| utf8mb4_general_ci |
+--------------------+
1 row in set
示例2:返回“_gb2312 'abc'”的字符集排序规则。

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
845
gbase> SELECT COLLATION(_gb2312 'abc') FROM dual;
+--------------------------+
| COLLATION(_gb2312 'abc') |
+--------------------------+
| utf8mb4_general_ci
|
+--------------------------+
1 row in set

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.