Is there a one-liner out there for this task? Note that I won't be using Oracle's SQL Plus.
A:
I found the answer just before publishing the question:
SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME='TABLE_NAME'.
Tshepang
2010-08-19 18:44:30
I choose this due to greater simplicity.
Tshepang
2010-08-26 13:47:35
+3
A:
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.
select utc.column_name
from user_tab_columns utc
where utc.TABLE_NAME = 'TABLE_NAME'
order by utc.COLUMN_ID
Welton v3.50
2010-08-19 18:48:13
what's the use of 'utc' and why r u ordering? thing is my answer gives the same result as urs.
Tshepang
2010-08-19 19:16:54
utc is just an alias for the table name. The SQL program I use has something like intellisence so it pops up column names after the dot. It's just a habit of mine from using the software. And I ordered the columns just so that they appear in the same order that they are declared in the table. Your answer does provide the same information.
Welton v3.50
2010-08-19 21:16:57