iSQL*Plus User's Guide and Reference
Release 9.0.1

Part Number A88826-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Command Reference, 16 of 38


DESCRIBE

DESC[RIBE] {[schema.]object[@connect_identifier]}

Lists the column definitions for the specified table, view, or synonym or the specifications for the specified function or procedure.

Terms | Usage | Examples | Top

Refer to the following list for a description of each term or clause:

schema

object

@connect_identifier

Usage | Terms | Examples | Top

The description for tables, views, types and synonyms contains the following information:

When you do a DESCRIBE, VARCHAR columns are returned with a type of VARCHAR2.

The DESCRIBE command allows you to describe objects recursively to the depth level set in the SET DESCRIBE command. You can also display the line number and indentation of the attribute or column name when an object contains multiple object types. For more information, see the SET command later in this chapter.

To control the width of the data displayed, use the SET LINESIZE command. For more information, see the SET command later in this chapter.

The description for functions and procedures contains the following information:

Examples | Terms | Usage | Top

To describe the view EMP_DETAILS_VIEW, enter

Keyboard icon
DESCRIBE EMP_DETAILS_VIEW

Screen icon
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPLOYEE_ID                               NOT NULL NUMBER(6)
 JOB_ID                                    NOT NULL VARCHAR2(10)
 MANAGER_ID                                         NUMBER(6)
 DEPARTMENT_ID                                      NUMBER(4)
 LOCATION_ID                                        NUMBER(4)
 COUNTRY_ID                                         CHAR(2)
 FIRST_NAME                                         VARCHAR2(20)
 LAST_NAME                                 NOT NULL VARCHAR2(25)
 SALARY                                             NUMBER(8,2)
 COMMISSION_PCT                                     NUMBER(2,2)
 DEPARTMENT_NAME                           NOT NULL VARCHAR2(30)
 JOB_TITLE                                 NOT NULL VARCHAR2(35)
 CITY                                      NOT NULL VARCHAR2(30)
 STATE_PROVINCE                                     VARCHAR2(25)
 COUNTRY_NAME                                       VARCHAR2(40)
 REGION_NAME                                        VARCHAR2(25)

To describe a procedure called CUSTOMER_LOOKUP, enter

Keyboard icon
DESCRIBE customer_lookup

Screen icon
PROCEDURE customer_lookup
Argument Name          Type     In/Out   Default?
---------------------- -------- -------- ---------
CUST_ID                NUMBER   IN
CUST_NAME              VARCHAR2 OUT

To create and describe the package APACK that contains the procedures aproc and bproc, enter

Keyboard icon
CREATE PACKAGE apack AS
PROCEDURE aproc(P1 CHAR, P2 NUMBER);
PROCEDURE bproc(P1 CHAR, P2 NUMBER);
END apack;
/

Screen icon
Package created.

Keyboard icon
DESCRIBE apack

Screen icon
PROCEDURE APROC
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 P1                             CHAR                    IN
 P2                             NUMBER                  IN
PROCEDURE BPROC
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 P1                             CHAR                    IN
 P2                             NUMBER                  IN

To create and describe the object type ADDRESS that contains the attributes STREET and CITY, enter

Keyboard icon
CREATE TYPE ADDRESS AS OBJECT
( STREET  VARCHAR2(20),
CITY    VARCHAR2(20)
);
/

Screen icon
Type created.

Keyboard icon
DESCRIBE address

Screen icon
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 STREET                                             VARCHAR2(20)
 CITY                                               VARCHAR2(20)

To create and describe the object type EMPLOYEE that contains the attributes LAST_NAME, EMPADDR, JOB_ID and SALARY, enter

Keyboard icon
CREATE TYPE EMPLOYEE AS OBJECT
(LAST_NAME VARCHAR2(30),
EMPADDR ADDRESS,
JOB_ID VARCHAR2(20),
SALARY NUMBER(7,2)
);
/

Screen icon
Type created.

Keyboard icon
DESCRIBE employee

Screen icon
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 LAST_NAME                                          VARCHAR2(30)
 EMPADDR                                            ADDRESS
 JOB_ID                                             VARCHAR2(20)
 SALARY                                             NUMBER(7,2)

To create and describe the object type addr_type as a table of the object type ADDRESS, enter

Keyboard icon
CREATE TYPE addr_type IS TABLE OF ADDRESS;
/

Screen icon
Type created.

Keyboard icon
DESCRIBE addr_type

Screen icon
 addr_type TABLE OF ADDRESS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 STREET                                             VARCHAR2(20)
 CITY                                               VARCHAR2(20)

To create and describe the object type addr_varray as a varray of the object type ADDRESS, enter

Keyboard icon
CREATE TYPE addr_varray AS VARRAY(10) OF ADDRESS;
/

Screen icon
Type created.

Keyboard icon
DESCRIBE addr_varray

Screen icon
 addr_varray VARRAY(10) OF ADDRESS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 STREET                                             VARCHAR2(20)
 CITY                                               VARCHAR2(20)

To create and describe the table department that contains the columns DEPARTMENT_ID, PERSON and LOC, enter

Keyboard icon
CREATE TABLE department
(DEPARTMENT_ID NUMBER,
PERSON EMPLOYEE,
LOC NUMBER
);
/

Screen icon
Table created.

Keyboard icon
DESCRIBE department

Screen icon
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DEPARTMENT_ID                                      NUMBER
 PERSON                                             EMPLOYEE
 LOC                                                NUMBER

To create and describe the object type rational that contains the attributes NUMERATOR and DENOMINATOR, and the METHOD rational_order, enter

Keyboard icon
CREATE OR REPLACE TYPE rational AS OBJECT
(NUMERATOR NUMBER,
DENOMINATOR NUMBER,
MAP MEMBER FUNCTION rational_order - 
RETURN DOUBLE PRECISION,
PRAGMA RESTRICT_REFERENCES
(rational_order, RNDS, WNDS, RNPS, WNPS) );
/
CREATE OR REPLACE TYPE BODY rational AS OBJECT
MAP MEMBER FUNCTION rational_order - 
RETURN DOUBLE PRECISION IS 
BEGIN
  RETURN NUMERATOR/DENOMINATOR;
END;
END;
/

Keyboard icon
DESCRIBE rational

Screen icon
Name                           Null?    Type
------------------------------ -------- ------------
NUMERATOR                               NUMBER
DENOMINATOR                             NUMBER

METHOD
------
MAP MEMBER FUNCTION RATIONAL_ORDER RETURNS NUMBER

To format the DESCRIBE output use the SET command as follows:

Keyboard icon
SET LINESIZE 80
SET DESCRIBE DEPTH 2
SET DESCRIBE INDENT ON
SET DESCRIBE LINE OFF

To display the settings for the object, use the SHOW command as follows:

Keyboard icon
SHOW DESCRIBE

Screen icon
describe DEPTH  2 LINENUM OFF INDENT ON

Keyboard icon
DESCRIBE employee

Screen icon
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FIRST_NAME                                         VARCHAR2(30)
 EMPADDR                                            ADDRESS
   STREET                                           VARCHAR2(20)
   CITY                                             VARCHAR2(20)
 JOB_ID                                             VARCHAR2(20)
 SALARY                                             NUMBER(7,2)

For more information on using the CREATE TYPE command, see your Oracle9i SQL Reference.

For information about using the SET DESCRIBE and SHOW DESCRIBE commands, see the SET and SHOW commands later in this chapter.


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback