返回首页

gbase数据、南大通用产品文档:GBase8sSQLTablePrivileges(仅限二级)

更新日期:2024年09月11日

SQLTablePrivileges 返回表和与每个表相关的特权的列表。
驱动程序将此信息作为指定 hstmt 上的结果集。
下表描述了 SQLTablePrivileges 的 SQLSTATE 和错误值。
SQLSTATE
错误值
错误消息
01000
-11001
General warning
08S01
-11020
Communication-link failure
24000
-11031
Invalid cursor state
S1000
-11060
General error
S1001
-11061
Memory-allocation failure
S1008
-11065
Operation canceled
S1010
-11067
Function-sequence error
S1090
-11071
Invalid string or buffer length
S1C00
-11092
Driver not capable
S1T00
-11094
Time-out expired

GBase 8s ODBC Driver 程序员指南
南大通用数据技术股份有限公司
- 242 -

SQLSTATE
错误值
错误消息
S1C00
-11300
SQL_DEFAULT_PARAM not supported
08S01
-11301
A protocol error has been detected. Current connection is
closed.
S1000
-11310
Create and Drop must be executed within a ServerOnly
Connection
S1000
-11320
Syntax error
S1000
-11323
The statement contained an escape clause not supported by
this database driver

参数说明:控制是否以绑核优化模式启动主DN 进程。配置该参数为0,则不进行绑核
优化;否则,进行绑核优化,且物理CPU 片数为2n 个。数据库、cm_agent 重启生效。仅
支持ARM。参数修改请参考表GUC 参数设置方式进行设置。
取值范围:整型,0~2。
默认值:0

语法格式
INSTR(str,substr)
INSTR(str,substr,start_position,N)
表5- 10 参数说明
参数
说明
str
字符串母串。
substr
字符串子串。
start_position
表示从字符串(左端)第几个字符开始匹配, 如是负数,则
从右端往前反向查找子串。可选参数,默认为1。
nth_appearance
从start_position 开始向字符串尾方向查找第几个匹配字符
串。可选参数,默认为1。
函数说明

第一种语法功能:
返回子串substr 在字符串str(左端开始)第一次出现的位置。如果没有,返
回0。如果有一个参数为NULL,则返回NULL。

第二种语法功能:
1. 查找第nth_appearance 个匹配字符串的功能;
2. 从母串的第start_position 个字符开始查找匹配字符串的功能;
3. 支持第三个参数start_position 为负数的情况,即从母串右侧第
|start_position|个位置反向查找子串的功能。

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
691
说明
substr 在str 中的位置,以1 开始计数。
返回的位置是按全字符串正向位置计数的,与从哪个位置开始无关
示例
示例1:返回“bar”在“foobarbar”中第一次出现的位置。
gbase> SELECT INSTR('foobarbar', 'bar') FROM dual;
+---------------------------+
| INSTR('foobarbar', 'bar') |
+---------------------------+
|
4 |
+---------------------------+
1 row in set
示例2:“foobar”不在“xbar”中。
gbase> SELECT INSTR('xbar', 'foobar') FROM dual;
+-------------------------+
| INSTR('xbar', 'foobar') |
+-------------------------+
|
0 |
+-------------------------+
1 row in set
示例3:如有任一参数是一个二进制字符串,则它是字母大小写敏感的。
gbase> SELECT INSTR('foobarbar', BINARY 'Bar') FROM dual;
+----------------------------------+
| INSTR('foobarbar', BINARY 'Bar') |
+----------------------------------+
|
0 |
+----------------------------------+
1 row in set
示例4:从字符串“beiwelcometobeijing”第三个字符开始匹配,查找“bei”第一
次出现的位置。
gbase> SELECT INSTR ('beiwelcometobeijing','bei',3) FROM dual;
+-----------------------------------+
| INSTR('beiwelcometobeijing','bei',3) |
+-----------------------------------+
|
13 |
+-----------------------------------+
1 row in set

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
692
示例5:
从字符串
“112111222222333333”
第一个字符开始匹配,
查找第二个
“11”
出现的位置。
gbase> SELECT INSTR ('112111222222333333','11',1,2) FROM dual;
+--------------------------------------+
| INSTR('112111222222333333','11',1,2) |
+--------------------------------------+
|
4 |
+--------------------------------------+
1 row in set
示例6:从字符串“welcometochina”倒数第一个字符开始匹配,查找第一个“e”
出现的位置。
gbase> SELECT INSTR ('welcometochina','e',-1,1) FROM dual;
+----------------------------------+
| INSTR('welcometochina','e',-1,1) |
+----------------------------------+
|
7 |
+----------------------------------+
1 row in set