Re: SQL Question: Describe <tablename>;

From: Bigus Dickus <no_spam_for_me_thanks_at_yahoo.com>
Date: Mon, 31 Mar 2003 07:12:30 -0800
Message-ID: <3E885ADE.A46962E1_at_yahoo.com>


Thanks for the suggestions. Unfortunately, I don't have a lot of time to go pouring through documentation, especially not last week. I needed some answers from my DB and the DBAs weren't around to ping. While I was in the process of looking through other books, etc. I thought I would toss the question out to the NG. In my 15+ years of using usenet, I have found that a question, such as the one I posted, will receive 3-4 answers that are F'ed up or flames from snot-nosed punks who think that it's 'cool' to be a hacker or something but couldn't tell you what BBS stands for, and 1-2 intelligent, constructive answers.

I took a stab at my initial query. I simply based it on the syntax of the select statement. It made sense to me for the following reason. "describe my_table;" returns precisely the information I was looking for. I just needed a way of filtering the fields so I don't get every single field. Thus, the "where" clause.

I could see "describe my_table where Name like '%AMT%';" or "describe my_table where Null?='';" The first would give you the description of all the fields in your table that are monetary, e.g. OPEN_BAL_AMT, CLOSE_BAL_AMT, HIGH_BAL_AMT, etc. The second would tell you which fields can't be null.

Theo's query gave me some ideas and also reminded me of the dictionary. Except that in our DB, 8.1.7J, the view is user_tab_columns. I could have just entered "select * from dictionary where table_name like '%COL%';" and found the description of the view I needed. However, sometimes when we are under the gun, we are a little too close to the problem to see the obvious.

Cheers.

Hans Forbrich wrote:

> Describe is not a traditional SQL command. Look it up in the manuals and
> you'll see that it really isn't very flexible.
>
> While you are looking up the Describe command, I encourage you to look up
> the Dictionary views ... check out DBA_TABLES, USER_TABLES, ALL_TABLES,
> ?_TAB_COLUMNS and also (I've heard deprecated, ut apparently still around)
> ?_TAB
>
> (The difference between DBA_TABLES, USER_TABLES, ALL_TABLES is well
> described in the documentation.)
>
> All of this information, and considerably more, is available for a small
> investment of time spent reading various documentation. You can find such
> documentation at http://otn.oracle.com
>
> For the sake of interest, where did you get the impression that "describe
> my_table where Type = CHAR(10);" might work? Is this from some book,
> manual or other DB manager? Or has someone provided another new feature I
> missed?
>
> /Hans
Received on Mon Mar 31 2003 - 17:12:30 CEST

Original text of this message