Home » SQL & PL/SQL » SQL & PL/SQL » Table Column
Table Column [message #312961] Thu, 10 April 2008 03:57 Go to next message
hadinatayp
Messages: 5
Registered: March 2008
Junior Member
is it possible in oracle we select column name from a table?

ex :

create table testt
(
    col1 varchar2(10),
    col2 varchar2(10),
    col3 varchar2(10)
);

-- select the column name list form table testt
select xxxxxxxxxxxxxxxxxxxxxxx from dual?


thx.
Re: Table Column [message #312966 is a reply to message #312961] Thu, 10 April 2008 04:15 Go to previous messageGo to next message
MarcS
Messages: 312
Registered: March 2007
Location: Antwerp
Senior Member
Have a look at USER_TAB_COLUMNS.

And when you're done, have a look at those other DATA DICTIONARY VIEWS as well
Re: Table Column [message #312971 is a reply to message #312961] Thu, 10 April 2008 04:25 Go to previous messageGo to next message
mohdbfaq
Messages: 5
Registered: April 2008
Junior Member
select
rtrim(max(decode(column_id,1,column_name))||','||
max(decode(column_id,2,column_name))||','||
max(decode(column_id,3,column_name))||','||
max(decode(column_id,4,column_name))||','||
max(decode(column_id,5,column_name))||','||
max(decode(column_id,6,column_name))||','||
max(decode(column_id,7,column_name))||','||
max(decode(column_id,8,column_name))||','||
max(decode(column_id,9,column_name))||','||
max(decode(column_id,10,column_name))||','||
max(decode(column_id,11,column_name))||','||
max(decode(column_id,12,column_name))||','||
max(decode(column_id,13,column_name))||','||
max(decode(column_id,14,column_name))||','||
max(decode(column_id,15,column_name))||','||
max(decode(column_id,16,column_name))||','||
max(decode(column_id,17,column_name))||','||
max(decode(column_id,18,column_name))||','||
max(decode(column_id,19,column_name))||','||
max(decode(column_id,20,column_name))||','||
max(decode(column_id,21,column_name))||','||
max(decode(column_id,22,column_name))||','||
max(decode(column_id,23,column_name))||','||
max(decode(column_id,24,column_name))||','||
max(decode(column_id,25,column_name))||','||
max(decode(column_id,26,column_name))||','||
max(decode(column_id,27,column_name))||','||
max(decode(column_id,28,column_name))||','||
max(decode(column_id,29,column_name))||','||
max(decode(column_id,30,column_name))||','||
max(decode(column_id,31,column_name))||','||
max(decode(column_id,32,column_name))||','||
max(decode(column_id,33,column_name))||','||
max(decode(column_id,34,column_name))||','||
max(decode(column_id,35,column_name))||','||
max(decode(column_id,36,column_name)),',')||' '
from user_tab_columns
where table_name='EMPLOYEES'
GROUP BY table_name;

Re: Table Column [message #312983 is a reply to message #312971] Thu, 10 April 2008 04:47 Go to previous message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
column_id,36

Why only 36 columns? What with the rest of them?
Previous Topic: package compiling problem
Next Topic: Got Problem in Reading Data From Text Files Using UTL_FILE Package in Oracle 10g Environment
Goto Forum:
  


Current Time: Wed Dec 07 06:47:26 CST 2016

Total time taken to generate the page: 0.08583 seconds