How to get the name and data type of the columns in a table?

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
Post Reply
Renan Orati
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 90
Joined: Thu, 23 Aug 2007 3:40 pm
Location: São José do Rio Preto - SP

I would like to know if there is any form or some function passing the name of the table I can return the names of the columns and the type of columns ...

Note: I do not want a command of the type "des" just to view ... I want you to return as a select to be able to export with spoll ... vlw !!!!

Thank you in advance !!! VLW people!
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

And ai renan, beleza ??

In Oracle There is a table called ALL_TAB_COLUMNS , in it this recorded some information about each column of your tables.
Here is an example:

Select all

 
SELECT COLUMN_NAME,  
       DATA_TYPE,  
       DATA_LENGTH,  
       DATA_PRECISION  
  FROM ALL_TAB_COLUMNS  
 WHERE UPPER(TABLE_NAME)='MINHA_TABELA' 

[]
Renan Orati
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 90
Joined: Thu, 23 Aug 2007 3:40 pm
Location: São José do Rio Preto - SP

Our kara !!! Vlw Even ...
Made Kara I was trying to find a way!
: D
vlwwwwwwwwwww !!!!!!
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

Beauty Maninho. !!!

Good Trampo Ai. !!!!!!!!!!! : D
Renan Orati
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 90
Joined: Thu, 23 Aug 2007 3:40 pm
Location: São José do Rio Preto - SP

Kara .... I just miss a little thing !!! rsrsrs
The description !!! Can you get the description ???
rsrs vlw !!!!! : D
Tineks
Rank: DBA Sênior
Rank: DBA Sênior
Posts: 365
Joined: Tue, 24 May 2005 2:24 pm
Location: Araraquara - SP
Cristiano (Tineks)
Araraquara - SP

Oops, you have brow.!

The comments you can pick up in the table all_col_comments ,
but you will have to do a join of this table with the all_tab_columns tying the name of the table and The column name. !! :)

Select all

 
SELECT COMMENTS 
  FROM ALL_COL_COMMENTS  
 WHERE UPPER(TABLE_NAME)='MINHA_TABELA' 
[] 's !!
Renan Orati
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 90
Joined: Thu, 23 Aug 2007 3:40 pm
Location: São José do Rio Preto - SP

It worked!!

vlw kara! =)
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests