Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Oracle > How to get all columns only of a table in Oracle?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-26-03, 01:15
Richard2003 Richard2003 is offline
Registered User
 
Join Date: Dec 2002
Posts: 9
How to get all columns only of a table in Oracle?

Dear all,

I have 2 questions that need your kind help.

1. In MySQL, we can use:

show columns from tableName

to show all columns.

How to do it in Oracle?

I used desc tableName, but it show Type and Nullable as well. Here I only need the column names as return, since I want to use it in Java Resultset to process it.


2. BTW, in MySQL, we use:

show databases

to show all the databases

what is the corresponding SQL in Oracle?


Thanks!
Reply With Quote
  #2 (permalink)  
Old 04-26-03, 02:47
osy45 osy45 is offline
Registered User
 
Join Date: Nov 2002
Posts: 833
I know of no such command , but you can retrieve the column_names
from all_tab_columns...

select column_name from all_tab_columns where table_name = <table_name> order by column_id ...
Reply With Quote
  #3 (permalink)  
Old 04-26-03, 02:50
osy45 osy45 is offline
Registered User
 
Join Date: Nov 2002
Posts: 833
as for you second question:

do you mean tablespace or instances ...

as for instances look at the tnsnames.ora and listener.ora files

otherwise look at dba_tablespaces
Reply With Quote
  #4 (permalink)  
Old 04-26-03, 03:46
RastogiKamesh RastogiKamesh is offline
Registered User
 
Join Date: Apr 2003
Location: Jagdishpur
Posts: 146
Re: How to get all columns only of a table in Oracle?

Quote:
Originally posted by Richard2003
Dear all,

I have 2 questions that need your kind help.

1. In MySQL, we can use:

show columns from tableName

to show all columns.

How to do it in Oracle?

I used desc tableName, but it show Type and Nullable as well. Here I only need the column names as return, since I want to use it in Java Resultset to process it.


2. BTW, in MySQL, we use:

show databases

to show all the databases

what is the corresponding SQL in Oracle?


Thanks!


Hi,
For you query No.1, You can use SYSTEM view for the tables in your current schema. The View name is "USER_TAB_COLUMS" . Pass the table name in your query & get the details about the columns.

Query No.2: There is nothing like different databases in Oracle like we use to have in SYbase. Here, in oracle, architecture is different. Here we have one database INstance & that u can treat it as Sybase Server sort of thing.
And we have different tablespaces in Oracle whcih u may understand like database in Sybase. So, for deatils about tablespaces, you may user SYSTEM view "USERs_TABLESPACE"

Hope, it will be helpful to you. See one thing, In Oracle virtually every thing is possible what we used to do it for SQL etc. Here, Check for SYSTEM Views & this gives good info. about all in Oracle.

Bye,
__________________
- KR
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On