欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

如何取得一个表的所有字段名用逗号分割

程序员文章站 2022-07-03 20:06:53
自从 oracle 9i 开始,就可以通过sys_connect_by_path 函数实现将从父节点到当前行内容以“path”或者层次元素列表的形式显示出来。 取得一个表...

自从 oracle 9i 开始,就可以通过sys_connect_by_path 函数实现将从父节点到当前
行内容以“path”或者层次元素列表的形式显示出来。

取得一个表的所有字段名,用逗号分割。

select max(substr(sys_connect_by_path(column_name, ','),2)) col from (
select column_name,column_id from user_tab_columns where table_name='&表名')
start with column_id=1
connect by column_id=rownum;