Re: Native ORACLE SQL language command for DESC(RIBE)

From: Fiona Lewis <fml1_at_soton.ac.uk>
Date: Thu, 15 Aug 2002 15:55:32 +0100
Message-ID: <ajgffi$k1c$1_at_aspen.sucs.soton.ac.uk>


Should work, but in basic terms ...

  select column_name, nullable, data_type||'('||data_length||')'   from user_tab_columns
  where table_name = 'YOUR_TABLE'

But this is not well formatted so if you want to mimic the output of DESC more closely...

  set pagesize 100
  set linesize 100
  column column_name heading 'Name' format a41 word_wrapped   column NN heading 'Null?' format a8
  column TYPE heading 'Type' format a28

  select column_name, decode(nullable,'N','NOT NULL','') as NN, data_type||'('||data_length||')' as TYPE   from user_tab_columns
  where table_name = 'YOUR_TABLE'

(assuming you don't have huge tables with long column names ... if so just play around with the column formatting!)

Describe can be used in embedded SQL in a similar way to running a query - i.e. using an 'EXEC SQL DESCRIBE' command after the PREPARE command - if that is how you are trying to use it.

Fiona Lewis
Research Fellow
Southampton University

"Sam" <samuel_ji_at_hotmail.com> wrote in message news:74c4b78.0208140924.1e2ab8d8_at_posting.google.com...
> Hello, the list,
>
> In SQL*PLUS, I could use DESC or DESCRIBE command to describing a
> table. But I do not think this command is part of the native ORACLE
> SQL language. Does any of you know the ORACLE SQL counterpart for this
> command?
>
> TIA,
>
> Sam
Received on Thu Aug 15 2002 - 16:55:32 CEST

Original text of this message