LightDB24.1 XMLELEMENT支持省略NAME关键字

时间:2024-04-15 07:20:08

功能介绍

为了兼容Oracle数据库的语法,LightDB24.1版本开始支持XMLELEMENT函数省略NAME关键字,功能不受影响。

使用示例

  1. 带有NAME关键字
lightdb@oracle_test=# SELECT xmlelement(name foo);
 xmlelement 
------------
 <foo/>
(1 row)

lightdb@oracle_test=# 
lightdb@oracle_test=# SELECT xmlelement(name foo, xmlattributes('xyz' as bar));
    xmlelement    
------------------
 <foo bar="xyz"/>
(1 row)

lightdb@oracle_test=# SELECT xmlelement(name foo, xmlattributes(current_date as bar), 'cont', 'ent');
             xmlelement              
-------------------------------------
 <foo bar="2024-03-06">content</foo>
(1 row)

lightdb@oracle_test=# 
  1. 省略NAME关键字
lightdb@oracle_test=# SELECT xmlelement(foo);
 xmlelement 
------------
 <foo/>
(1 row)

lightdb@oracle_test=# SELECT xmlelement(foo, xmlattributes('xyz' as bar));
    xmlelement    
------------------
 <foo bar="xyz"/>
(1 row)

lightdb@oracle_test=# SELECT xmlelement(foo, xmlattributes(current_date as bar), 'cont', 'ent');
             xmlelement              
-------------------------------------
 <foo bar="2024-03-06">content</foo>
(1 row)

lightdb@oracle_test=#