显示 Oracle 表的列名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3525096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:18:47 来源:igfitidea点击:
displaying Oracle table's column names
提问by tshepang
Is there a one-liner out there for this task? Note that I won't be using Oracle's SQL Plus.
是否有专为这项任务设计的单线?请注意,我不会使用 Oracle 的 SQL Plus。
回答by Welton v3.59
This statement will select all the columns for a table, just replace 'TABLE_NAME' with the actual name of the table. Keep in mind that the tables names are uppercase.
此语句将选择表的所有列,只需将 'TABLE_NAME' 替换为表的实际名称。请记住,表名称是大写的。
select utc.column_name
from user_tab_columns utc
where utc.TABLE_NAME = 'TABLE_NAME'
order by utc.COLUMN_ID
回答by tshepang
SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME='TABLE_NAME'