当前位置:网站首页>Kingbasees SQL language reference manual of Jincang database (8. Function (V))
Kingbasees SQL language reference manual of Jincang database (8. Function (V))
2022-07-23 10:27:00 【Thousands of sails passed by the side of the sunken boat_】
8.140. HAS_ANY_COLUMN_PRIVILEGE
usage :
has_any_column_privilege(user, table, privilege) has_any_column_privilege(table, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether any column of a table can be accessed in a specific way . The desired access type must be a combination of the following values :SELECT、INSERT、UPDATEorREFERENCES. Note that having any of these permissions at the table level will implicitly grant it to each column on the table .Example :
CREATE TABLE tbl(); SELECT has_any_column_privilege('tbl', 'INSERT, UPDATE, REFERENCES');
8.141. HAS_COLUMN_PRIVILEGE
usage :
has_column_privilege(user, table, column, privilege) has_column_privilege(table,column, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a table can be accessed in a specific waycolumnSpecified column .has_column_privilegeCheck whether a user can access a column in a specific way . Its parameter possibility is similar tohas_table_privilegesimilar , And the column can also be specified by name or attribute number . The desired access type must be a combination of the following values :SELECT、INSERT、UPDATEorREFERENCES. Note that having any of these permissions at the table level will implicitly grant it to each column on the table .Example :
SELECT has_column_privilege(9999,'nosuchcol','select'); SELECT has_column_privilege('mytable','f2','select');
8.142. HAS_DATABASE_PRIVILEGE
usage :
has_database_privilege(user, database, privilege) has_database_privilege(database, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether it is possible toprivilegeSpecify how to accessdatabasedatabase . The desired access type must be some combination of the following values :CREATE、CONNECT、TEMPORARYorTEMP( Equivalent toTEMPORARY).Example :
SELECT has_database_privilege(current_database(), 'CONNECT');
8.143. HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE
usage :
has_foreign_data_wrapper_privilege(user, fdw, privilege) has_foreign_data_wrapper_privilege(fdw, privilege)function :
Check ``user`` user ( If not specified, use the current user ) Whether an external data wrapper can be accessed in a specific way . Its parameter possibility is similar to
has_table_privilege. The desired access type must beUSAGE.Example :
SELECT has_foreign_data_wrapper_privilege('foo', 'USAGE');
8.144. HAS_FUNCTION_PRIVILEGE
usage :
has_function_privilege(user, function, privilege) has_function_privilege(function, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a function can be accessed in a specific way . The parameter possibility is similarhas_table_privilege. Using a text string instead of OID When specifying a function , Allowed inputs andregprocedureThe data types are the same ( Refer to the Object identifier type ). The desired access type must beEXECUTE.Example :
SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
8.145. HAS_LANGUAGE_PRIVILEGE
usage :
has_language_privilege(user, language, privilege) has_language_privilege(language, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a process language can be accessed in a specific way . The desired access type must be USAGE.Example :
SELECT has_database_privilege(current_database(), 'CONNECT');
8.146. HAS_SCHEMA_PRIVILEGE
usage :
has_schema_privilege(user, schema, privilege) has_schema_privilege(schema, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether it is possible toprivilegeSpecify how to accessschema. The desired access type must be CREATE or USAGE.Example :
SELECT has_schema_privilege('public', 'USAGE');
8.147. HAS_SEQUENCE_PRIVILEGE
usage :
has_sequence_privilege(user, sequence, privilege) has_sequence_privilege(sequence, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a sequence can be accessed in a particular way . The type of access you want to test must be one of the following :USAGE、SELECTorUPDATE.Example :
CREATE SEQUENCE x_seq; SELECT has_sequence_privilege('x_seq', 'SELECT');
8.148. HAS_SERVER_PRIVILEGE
usage :
has_server_privilege(user, server, privilege) has_server_privilege(server, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether you can access an external server in a specific way . The desired access type must be CREATE or USAGE.Example :
SELECT has_server_privilege('regress_test_role',(SELECT oid FROM pg_foreign_server WHERE srvname='s8'), 'USAGE');
8.149. HAS_TABLE_PRIVILEGE
usage :
has_table_privilege(user, table, privilege) has_table_privilege(table,privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a table can be accessed in a specific way . The user can use the name or OID (sys_authid.oid) To specify the , It can also be used.publicExpress PUBLIC Pseudo role . If this parameter is omitted , Then usecurrent_user. The table can be by name or OID Appoint ( therefore , There are actually six kinds ofhas_table_privilegeA variation of the , We can distinguish them by the number and type of their parameters ) . If specified by name , Then the name can be schema qualified if necessary . The desired permission type is specified with a text string , It must be one of the following values :SELECT、INSERT、UPDATE、DELETE、TRUNCATE、REFERENCESorTRIGGER.WITH GRANT OPTIONYou can choose to add to a permission type to test whether the permission is obtained by using the delegation option . in addition , You can use commas to separate multiple permission types , In this case, as long as you have one of the permissions, the result isreally( The case of the permission string is not important , Additional white space can appear between permission names , However, there must be no blank space inside the permission name ).Example :
SELECT has_table_privilege('myschema.mytable', 'select'); SELECT has_table_privilege('joe', 'mytable', 'INSERT, SELECT WITH GRANT OPTION');
8.150. HAS_TABLESPACE_PRIVILEGE
usage :
has_tablespace_privilege(user, tablespace, privilege) has_tablespace_privilege(tablespace, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a table space can be accessed in a specific way . The parameter possibility is similar ``has_table_privilege``. The desired access type must beCREATE.Example :
CREATE TABLESPACE mytsp LOCATION '/path/to/mytsp'; SELECT has_tablespace_privilege('mytsp', 'CREATE');
8.151. HAS_TYPE_PRIVILEGE
usage :
has_type_privilege(user, type, privilege) has_type_privilege(type, privilege)function :
Check
useruser ( If not specified, use the current user ) Whether a type can be accessed in a specific way . The possibility of its parameters is similar tohas_table_privilege. Using strings instead of OID When specifying the type , Allowed inputs andregtypeSame data type ( see Object identifier type ). The expected access privilege type must be equal toUSAGE.Example :
SELECT has_type_privilege('int8', 'USAGE');
8.152. HEIGHT
usage :
height(box)function :
Geometric functions , Returns the vertical dimension of the box
Example :
SELECT height(box '((0,0),(1,1))');
8.153. HOST
usage :
height(inet)function :
inet function , extract IP Address is text .
Example :
SELECT host('192.168.1.5/24');
8.154. HOSTMASK
usage :
hostmask(inet)function :
inet function , Construct a host mask for the network address .
Example :
SELECT hostmask('192.168.23.20/30');
8.155. IF
usage :
if(expr1 INT Compatibility type , expr2 Any type , expr3 Any type )function :
If expr1 Not for NULL also expr1 It's not equal to 0, return expr2 As a result , Otherwise return to expr3.
Parameter description :
expr1 yes INTEGER Type expressions can be converted into INTEGER The type of .
expr2 The data type can be one of the data types of the system ( Such as :TEXT,INTEGER,FLOAT etc. ).
expr3 The data type can be one of the data types of the system ( Such as :TEXT,INTEGER,FLOAT etc. ).
Return value description :
The data type of the return value : The return type depends on expr2,expr3 The type of .
Example :
SELECT IF(100, 'T', 'F') AS RESULT1, IF(1 - 1, 'T', 'F') AS RESULT2, IF('100', 'T', 'F') AS RESULT3, IF(NULL, 'T', 'F') AS RESULT4;
8.156. IFNULL
usage :
ifnull(expr1, expr2)function :
When ``expr1`` No NULL,
IFNULL return``expr1``. Otherwise it returns ``expr2``Example :
SELECT ifnull(NULL,'exp2'); SELECT ifnull('exp1','exp2');
8.157. INET_CLIENT_ADDR
usage :
inet_client_addr()function :
inet_client_addrReturns the... Of the current client IP Address . If the connection is through Unix Domain socket , return NULL.Example :
SELECT inet_client_addr();
8.158. INET_CLIENT_PORT
usage :
inet_client_port()function :
inet_client_portReturn the port number of the current client . If the connection is through Unix Domain socket , return NULL.Example :
SELECT inet_client_port();
8.159. INET_MERGE
usage :
inet_merge(inet,inet)function :
inet_mergeReturns the smallest network including a given network .Example :
SELECT inet_merge('192.168.1.5/24', '192.168.2.5/24');
8.160. INET_SAME_FAMILY
usage :
inet_same_family(inet, inet)function :
Judge whether the addresses are the same IP Protocol family .
Example :
SELECT inet_same_family(('192.168.1.5/24', '::1'));
8.161. INET_SERVER_ADDR
usage :
inet_server_addr()function :
inet_server_addrReturns the of the server that accepts the current connection IP. If the connection is through Unix Domain socket , return NULL.Example :
SELECT inet_server_addr();
8.162. INET_SERVER_PORT
usage :
inet_server_port()function :
inet_server_portReturns the port number of the server that accepts the current connection . If the connection is through Unix Domain socket , return NULL.Example :
SELECT inet_server_port();
8.163. INITCAP
usage :
initcap(string)function :
INITCAP return char, The first letter of each word is capitalized , All other letters are lowercase . Words are separated by spaces or non alphanumeric characters .
char It can be any data type CHAR、VARCHAR、NCHAR or NVARCHAR. Return value and The same data type char. The database sets the initial character case based on the binary mapping defined for the base character set .
Example :
The following example capitalizes each word in a string :
SELECT initcap('hi THOMAS');
8.164. INSERTCHILDXML
usage :
insertchildxml(xml_instance xml, xpath text, child_expr text , value_expr xml) insertchildxml(xml_instance xml, xpath text , child_expr text ,value_expr xml, namespace _text)function :
function
insertchildxmltake ``value_expr`` The value provided is used as ``xpath`` The child nodes of the specified node are inserted into ``xml_instance`` in . If successful, the inserted ``xml_instance`` data , Failure returns ERROR.Before using this function, you need to create kdb_utils_function Expand .
Example :
SELECT insertchildxml('<a>one <b></b> three <b></b></a>', '//b', 'name', '<name>newnode</name>'); SELECT insertchildxml('<a xmlns="http://example.com"><b>test</b></a>', '//mydefns:b/text()', 'name', '<name>newnode</name>', ARRAY[ARRAY['mydefns', 'http://example.com']]);
8.165. INSERTCHILDXMLAFTER
usage :
insertchildxmlafter(xml_instance xml, xpath text, child_expr text , value_expr xml) insertchildxmlafter(xml_instance xml, xpath text , child_expr text ,value_expr xml,namespace _text)function :
function
insertchildxmlaftertake ``value_expr`` One or more collection elements provided as ``xpath`` The child element of the specified target parent element is inserted into ``child_expr`` After the specified existing collection element . If successful, the inserted ``xml_instance`` data , Failure returns ERROR.Before using this function, you need to create kdb_utils_function Expand .
Example :
In all of the specified nodes “b” Insert after the child node :
SELECT insertchildxmlafter('<a>one<b>two</b><b>four</b></a>', '/a', 'b', '<c>three</c>');At the first of the specified nodes “b” Insert after the child node
SELECT insertchildxmlafter('<a>one<b>two</b><b>four</b></a>', '/a', 'b[1]', '<c>three</c>');In the second of the specified node “b” Insert after the child node
SELECT insertchildxmlafter('<a>one<b>two</b><b>four</b></a>', '/a', 'b[2]', '<c>three</c>');
8.166. INSERTCHILDXMLBEFORE
usage :
insertchildxmlbefore(xml_instance xml, xpath text, child_expr text , value_expr xml) insertchildxmlbefore(xml_instance xml, xpath text , child_expr text , value_expr xml,namespace _text)function :
function
insertchildxmlbeforetake ``value_expr`` One or more collection elements provided as ``xpath`` The child element of the specified target parent element is inserted into ``child_expr`` Before the specified existing collection element . If successful, the inserted ``xml_instance`` data , Failure returns ERROR.Before using this function, you need to create kdb_utils_function Expand .
Example :
In all of the specified nodes “b” Insert before the child node :
SELECT insertchildxmlbefore('<a>one<b>23</b><b>two<d>four</d></b></a>', '/a', 'b', '<c>three</c>');At the first of the specified nodes “b” Insert before the child node :
SELECT insertchildxmlbefore('<a>one<b>two</b></a>', '/a', 'b[1]', '<c>three</c>');In the second of the specified node “b” Insert before the child node :
SELECT insertchildxmlbefore('<a>one<b>23</b><b>two<d>four</d></b></a>', '/a', 'b[2]', '<c>three</c>');
8.167. INSERTXMLAFTER
usage :
insertxmlafter(xml_instance xml, xpath text , value_expr xml) insertxmlafter(xml_instance xml, xpath text , value_expr xml,namespace _text)function :
function
insertxmlaftertake ``value_expr`` The value provided is inserted into ``xpath`` After the specified node . If successful, the inserted ``xml_instance`` data , Failure returns ERROR.Before using this function, you need to create kdb_utils_function Expand .
Example :
SELECT insertxmlafter('<a xmlns="http://example.com"><b>test</b></a>', '//mydefns:b/text()', '<name>newnode</name>', ARRAY[ARRAY['mydefns', 'http://example.com']]);
8.168. INSERTXMLBEFORE
usage :
insertxmlbefore(xml_instance xml, xpath text , value_expr xml) insertxmlbefore(xml_instance xml, xpath text , value_expr xml,namespace _text)function :
function
insertxmlbeforetake ``value_expr`` The value provided is inserted into ``xpath`` Before the specified node . If successful, the inserted ``xml_instance`` data , Failure returns ERROR.Before using this function, you need to create kdb_utils_function Expand .
Example :
SELECT insertxmlbefore('<a><b>b</b></a>','/a/b','<c>c</c>'); SELECT insertxmlbefore('<a><b></b></a>','/a/b','<c>c</c>'); SELECT insertxmlbefore('<a><b></b></a>','/a/b','<c></c>'); SELECT insertxmlbefore('<a xmlns="http://example.com"><b>test</b></a>', '//mydefns:b/text()', '<name>newnode</name>', ARRAY[ARRAY['mydefns', 'http://example.com']]);
8.169. INSTR
usage :
instr(expr1 text, expr2 text,[expr3 int[,expr4 int]])function :
In the parent string expr1 No expr3 A place ( from 1 Start ) Start to find the number expr4 The position of the substring of the second occurrence ,0 Indicates that it does not contain a substring expr2. If expr3 Negative , From expr1 The last of expr3 Reverse lookup started at , The position is still calculated from the beginning of the string .
Example :
SELECT instr('bcaaaaabbc', 'a', -2);
8.170. INSTRB
usage :
instrb(expr1 text,expr2 text,[expr3 int[,expr4 int]])function :
In the parent string expr1 No expr3 A place ( from 1 Start ) Start to find the number expr4 The position of the substring of the second occurrence , 0 Indicates that it does not contain a substring expr2. If expr3 Negative , From expr1 The last of expr3 Reverse lookup started at , The position is still calculated from the beginning of the string .
Example :
SELECT instrb(’bcaaaaabbc’, ’a’, -2);
8.171. ISEMPTY
usage :
isempty(anyrange)function :
Range of judgment
anyrangeIs it empty .Example :
SELECT isempty(numrange(1.1,2.2));
8.172. ISFINITE
usage :
isfinite(date) isfinite(timestamp) isfinite(interval)function :
Judge whether the incoming parameter is a finite value .
Example :
SELECT isfinite(date '2001-02-16'); SELECT isfinite(timestamp '2001-02-16 21:28:30'); SELECT isfinite(interval '4 hours');
8.173. ISNULL
usage :
isnull(expr1 Any type , expr2 Any type )function :
Equivalent to function
NVL(expr1Any type ,expr2Any type ). Whenexpr1by NULL when , useexpr2Replace the value of this expression ; Otherwise, the value of this function remainsexpr1Original value of . in additionexpr1Andexpr2The data type can be one of the data types of the system ( Such as :TEXT、INTEGER、FLOAT etc. ),expr1andexpr2The data type of should be consistent .If
expr1Not for NULL, The data type is the same asexpr1; Ifexpr1by NULL, The data type is the same asexpr2.In terms of compatibility ,
ISNULLamount to MSSQL 2005 MediumISNULLfunction 、KingbaseES MediumNVLfunction 、ORACLE MediumNVLfunction .Example :
SELECT ISNULL('2001-01-10', TO_DATE('05 Dec 2000', 'DD Mon YYYY')) AS RESULT1, ISNULL(NULL, TO_DATE('05 Dec 2000', 'DD Mon YYYY')) AS RESULT2, ISNULL(NULL, 123) AS RESULT3, ISNULL(789, 123) AS RESULT4, ISNULL(NULL, '123') AS RESULT5;
8.174. ISOPEN
usage :
isopen(path)function :
Geometric functions , Judge whether the parameter is an open path .
Example :
isopen(path '[(0,0),(1,1),(2,0)]')
边栏推荐
- One of the series of composition principle analysis, the design principle of composition
- 金仓数据库 KingbaseES SQL 语言参考手册 (8. 函数(五))
- EasyCVR平台CGO回放回调参数缺失导致设备录像无法播放,该如何解决?
- 【学习笔记】AGC022
- Nine charts overview the cycle law of encryption Market
- Redis transaction, lock mechanism, seckill
- Error msb4181: the "qtrunwork" task returned false, but no error was recorded
- Evidence based design of RF circuits
- Redis transaction - detailed implementation process of seckill case simulation
- Cache penetration, cache breakdown, cache avalanche
猜你喜欢

隐适美invisAlign口扫转诊方式(导出口扫数据+线上问诊)

MD5加密解密网站测试,MD5加密还安全吗?

MySQL queries all table names and column information of the database through SQL

What is the difference between College coder and 985 programmer?

内存屏障中的读写屏障——并发问题

网络数据泄露事件频发,个人隐私信息如何保护?

MySQL基础篇(运算符、排序分页、多表查询、函数)

redis的事务、锁机制、秒杀

Illustration and text demonstrate the movable range of the applet movable view
![[c#] IEnumerable可枚举类型接口分析yield](/img/08/8c346ce257b4adc0bea80bf05b6f52.png)
[c#] IEnumerable可枚举类型接口分析yield
随机推荐
数据中台、BI业务访谈(三):如何选择合适的访谈对象
Redis transaction - detailed implementation process of seckill case simulation
SSH supermarket inventory management system
vs中新建文件/筛选器/文件夹
A concise tutorial for soft exam system architecture designer | reverse engineering
UE5 官方案例Lyra全特性详解 6.生成防御塔
S2SH+mysql的在线英语学习系统
RDB和AOF的优缺点
Error msb4181: the "qtrunwork" task returned false, but no error was recorded
VirtualBox如何设置端口转发?
MySQL queries all table names and column information of the database through SQL
redis的事务、锁机制、秒杀
[c #] IEnumerable enumerable type interface analysis yield
redis token记录用户登录设计求解?
Learn and understand Architecture Design from business development
【300+精选大厂面试题持续分享】大数据运维尖刀面试题专栏(七)
The world is being devoured by open source software
多线程中的「lost wake up 问题」| 为什么wait()和notify()需要搭配synchonized关键字使用?
LeetCode每日一题(1946. Largest Number After Mutating Substring)
Kingbasees SQL language reference manual of Jincang database (8. Function (8))