SQL - Plus Command Reference
SQL - Plus Command Reference
com/en/)
Sign In (http://www.oracle.com/webapps/redirect/signon?nexturl=https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12019.htm)
Home (/) / Database (/en/database/database.html) / Oracle Database Online Documentation, 10g Release 2 (10.2) (../../index.htm) / Administration (../../nav/portal_3.htm)
DESCRIBE
Syntax
DESC[RIBE] {[schema.]object[@db_link]}
Lists the column definitions for the specified table, view or synonym, or the specifications for the specified function or procedure.
Terms
schema
Represents the schema where the object resides. If you omit schema, SQL*Plus assumes you own object.
object
Represents the table, view, type, procedure, function, package or synonym you wish to describe.
@db_link
Consists of the database link name corresponding to the database where object exists. For more information on which privileges allow access to
another table in a different schema, refer to the Oracle Database SQL Reference (../b14200/toc.htm) .
Usage
The description for tables, views, types and synonyms contains the following information:
whether or not null values are allowed (NULL or NOT NULL) for each column
datatype of columns, for example, CHAR, DATE, LONG, LONGRAW, NUMBER, RAW, ROWID, VARCHAR2 (VARCHAR), or XMLType
When you do a DESCRIBE, VARCHAR columns are returned with a type of VARCHAR2.
The DESCRIBE command enables 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.
To control the width of the data displayed, use the SET LINESIZE command.
Columns output for the DESCRIBE command are typically allocated a proportion of the linesize currently specified. Decreasing or increasing the
linesize with the SET LINESIZE command usually makes each column proportionally smaller or larger. This may give unexpected text wrapping in
your display. For more information, see the SET command.
The description for functions and procedures contains the following information:
Examples
DESCRIBE EMP_DETAILS_VIEW
DESCRIBE customer_lookup
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
CREATE PACKAGE apack AS PROCEDURE aproc(P1 CHAR, P2 NUMBER); PROCEDURE bproc(P1 CHAR, P2 NUMBER); END apack; /
Package created.
DESCRIBE apack
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
Type created.
DESCRIBE address
To create and describe the object type EMPLOYEE that contains the attributes LAST_NAME, EMPADDR, JOB_ID and SALARY, enter
CREATE TYPE EMPLOYEE AS OBJECT (LAST_NAME VARCHAR2(30), EMPADDR ADDRESS, JOB_ID VARCHAR2(20), SALARY NUMBER(7,2) );
/
Type created.
DESCRIBE employee
To create and describe the object type addr_type as a table of the object type ADDRESS, enter
Type created.
DESCRIBE addr_type
To create and describe the object type addr_varray as a varray of the object type ADDRESS, enter
Type created.
DESCRIBE addr_varray
To create and describe the table department that contains the columns DEPARTMENT_ID, PERSON and LOC, enter
Table created.
DESCRIBE department
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; / DESCRIBE rational
Name Null? Type ------------------------------ -------- ------------ NUMERATOR NUMBER DENOMINATOR NUMBER METHOD -
----- MAP MEMBER FUNCTION RATIONAL_ORDER RETURNS NUMBER
To create a table which contains a column of XMLType, and describe it, enter
Table created
DESCRIBE PROPERTY;
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:
SHOW DESCRIBE
DESCRIBE employee
To create and describe the table des2_table which contains an encrypted column col2, enter
CREATE TABLE des2_table ( col1 VARCHAR2(10), col2 VARCHAR2(15) ENCRYPT, col3 CHAR(5), col4 CHAR(20));
Table created
DESCRIBE des2_table;
Name Null? Type ----------------------------------------- -------- ---------------------- COL1 VARCHAR2(10) COL2
VARCHAR2(15) ENCRYPT COL3 CHAR(5) COL4 CHAR(20)
For more information on using the CREATE TYPE command, see your Oracle Database SQL Reference (../b14200/toc.htm) .
For information about using the SET DESCRIBE and SHOW DESCRIBE commands, see the SET (ch12039.htm#i2698538) and SHOW
(ch12041.htm#i2699447) commands.
Page 41 of 83
(https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12020.htm)
(https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12018.htm)
(#)
About Oracle (http://www.oracle.com/corporate/index.html) Contact Us (http://www.oracle.com/us/corporate/contact/index.html) Legal Notices (http://www.oracle.com/us/legal/index.html) Terms of Use