Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: dba_tab_columns

Re: dba_tab_columns

From: Taji <gabsaga_tata_at_hotmail.com>
Date: 15 Jul 2003 11:59:32 -0700
Message-ID: <15619060.0307151059.322351e@posting.google.com>


Well, finally got it work and if anyone was wondering, here is the code.

select column_name,

decode (nullable, 'Y', 'NULL','NOT NULL') as "Null?",
RTRIM(decode(data_type || '(' || data_precision ||
decode(data_scale,0,'',null,'',',' || data_scale) || ')',
     'DATE()','DATE', 
      'VARCHAR2()', data_type || '(' || data_length || ')' , 
      data_type || '(' || data_precision ||
decode(data_scale,0,'',null,'',',' || data_scale) || ')')) as type from dba_tab_columns where table_name = 'TABLE_NAME_GOES_HERE' order by column_id

Taji

Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl> wrote in message news:<8ib6hvgm0hgsb9hcprtad0hqa12rqdinmq_at_4ax.com>...
> On 14 Jul 2003 14:17:16 -0700, gabsaga_tata_at_hotmail.com (Taji) wrote:
>
> >Does anyone happen to know the exact select statement that the
> >'describe' command emulates? I tried something like the following but
> >it didn't exactly work 'cause when the data_type is a VARCHAR, it
> >doesn't show the number of characters.
> >
> >select column_name, decode (nullable, 'Y', 'NULL','NOT NULL') ,
> >data_type,
> >data_precision,
> >data_scale
> >from dba_tab_columns
> >where table_name = 'TABLE_NAME_GOES_HERE' order by column_id"
> >
> >Thanks.
> >
> >Taji.
>
>
> I don't think your assertion is correct. IIRC there is a data_length
> column which is being used in non-numeric columns
> Just describe dba_tab_columns, grin
>
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address
Received on Tue Jul 15 2003 - 13:59:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US