Oracle SQL - Describing Database Objects


To get a quick overview of the structure of a table, for example, to see the column names and the data types, use the SQL*Plus DESCRIBE command.


SQL>--   w w  w. j  a  v a 2 s. c  o  m
SQL> drop table emp;

Table dropped.

SQL> create table emp(
  2  empno      NUMBER(4)    primary key,
  3  ename      VARCHAR2(8)  not null   ,
  4  init       VARCHAR2(5)  not null   ,
  5  job        VARCHAR2(8)             ,
  6  mgr        NUMBER(4)               ,
  7  bdate      DATE         not null   ,
  8  msal       NUMBER(6,2)  not null   ,
  9  comm       NUMBER(6,2)             ,
 10  deptno     NUMBER(2)    default 10) ;
SQL> descr emp
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPNO                                     NOT NULL NUMBER(4)
 ENAME                                     NOT NULL VARCHAR2(8)
 INIT                                      NOT NULL VARCHAR2(5)
 JOB                                                VARCHAR2(8)
 MGR                                                NUMBER(4)
 BDATE                                     NOT NULL DATE
 MSAL                                      NOT NULL NUMBER(6,2)
 COMM                                               NUMBER(6,2)
 DEPTNO                                             NUMBER(2)