VastbaseE100

基于开源技术的HTAP数据库管理系统。性能优异,稳定可靠,提供诸多专属领域特性。

Menu

DBMS_ASSERT

  • DBMS_ASSERT提供断言输入值的各种属性的函数。如果不满足确定函数中断言的属性的条件,则会引发值错误。否则,通过返回值返回输入值
函数名 参数类型 结果类型 描述
enquote_literal str character varying character varying 将前导单引号和尾随单引号添加到字符串文本
enquote_name str character varying character varying 用双引号括起名称
enquote_name str character varying, loweralize boolean character varying 用双引号括起名称,如果为TRUE或default,则不在引号中的str的字母字符将转换为大写
noop str character varying character varying 直接返回不做检查
object_name str character varying character varying 验证输入参数字符串是否是现有SQL对象的合格SQL标识符
qualified_sql_name str character varying character varying 数验证输入字符串是否为限定的SQL名称
schema_name str character varying character varying 验证输入字符串是否为现有架构名称
simple_sql_name str character varying character varying 验证输入字符串是否是简单的SQL名称
atlasdb=# SELECT dbms_assert.enquote_literal('SERVERS') FROM dual;
 enquote_literal 
-----------------
 'SERVERS'
(1 row)
atlasdb=# SELECT dbms_assert.enquote_name('SERVERS') FROM dual;
 enquote_name 
--------------
 "servers"
(1 row)

atlasdb=# SELECT dbms_assert.enquote_name('"SERVERS"') FROM dual;
 enquote_name  
---------------
 """servers"""
(1 row)

atlasdb=# SELECT dbms_assert.noop('SERVERS') FROM dual;
  noop   
---------
 SERVERS
(1 row)
atlasdb=# SELECT dbms_assert.QUALIFIED_SQL_NAME ('UWCLASS.SERVERS1') FROM dual;
 qualified_sql_name 
--------------------
 UWCLASS.SERVERS1
(1 row)
atlasdb=# SELECT dbms_assert.schema_name('oracle') FROM dual;
 schema_name 
-------------
 oracle
(1 row)
atlasdb=# SELECT dbms_assert.schema_name('UWCLASZ') FROM dual;
ERROR:  invalid schema name
atlasdb=# SELECT dbms_assert.simple_sql_name('SERVERS1') FROM dual;
 simple_sql_name 
-----------------
 SERVERS1
(1 row)
atlasdb=# SELECT dbms_assert.object_name('PG_TEMP_3') FROM dual;
ERROR:  invalid object name
atlasdb=# create table atlasdb.mytab (id int);
CREATE TABLE
atlasdb=# SELECT dbms_assert.object_name('mytab') FROM dual;
 object_name 
-------------
 mytab
(1 row)