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
  

Poston Wed, 26 Sep 2007 3:31 pm

I wonder if there is some way or some function by passing the name of the table I can return the column names and types of the columns ... Note: I do not want a command like \"DESC\" just for show ... I want to return as a SELECT to be able to export with spoll ... vlw!!!!

I appreciate there in advance!!! vlw people!
Renan Orati
Location: São José do Rio Preto - SP

Poston Wed, 26 Sep 2007 4:52 pm

And ai Renan, beleza?

in Oracle there is a table named , ALL_TAB_COLUMNS her this recorded some information about each column of your tables.
There follows an example:
Code: Select all
SELECT COLUMN_NAME,
       DATA_TYPE,
       DATA_LENGTH,
       DATA_PRECISION
  FROM ALL_TAB_COLUMNS
WHERE UPPER(TABLE_NAME)='MINHA_TABELA'
[] 's
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Wed, 26 Sep 2007 5:10 pm

Our kara!!! vlw same ... did I was kara wheel trying to find a way!
:D vlwwwwwwwwwwww!!!!!!
Renan Orati
Location: São José do Rio Preto - SP

Poston Wed, 26 Sep 2007 5:14 pm

Beauty BRO.!!!

good job there.!!!!!!!!!!!! :D
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Wed, 26 Sep 2007 6:04 pm

kara .... so miss a thing!!! lol the description!!! has how to get the description???
lol vlw!!!!! :D
Renan Orati
Location: São José do Rio Preto - SP

Poston Wed, 26 Sep 2007 6:57 pm

Oops, Yes, Bro.!

the comments u can get in the table ALL_COL_COMMENTS , but you'll have to do a join this table with ALL_TAB_COLUMNS tying the table name and the column name!! :)

Code: Select all
SELECT COMMENTS
  FROM ALL_COL_COMMENTS
WHERE UPPER(TABLE_NAME)='MINHA_TABELA'


[]'s!!
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Fri, 05 Oct 2007 3:27 pm

It worked!!

kara vlw! =)
Renan Orati
Location: São José do Rio Preto - SP


  • See also
    Replies
    Views
    Last Post


      Return to SQL

      Who is online

      Users browsing this forum: No registered users and 5 guests