Sunday, 3 July 2011

Displaying table definition using DESCRIBE

You can display the structure of a table using SQL*PLUS command DESCRIBE. It displays then name, datatype and whether the column can store null value for each column of the table.

The following is the syntax of DESCRIBE command.

DESC[RIBE] objectname

Displays the column definitions for the specified object. The object may be a table, view, synonym, function or procedure.


To display the structure of COURSES table, enter:

SQL> DESC COURSES
Name Null? Type
---------------------------------------------- -------- ----------
CCODE NOT NULL VARCHAR2(5)
NAME VARCHAR2(30)
DURATION NUMBER(3)
FEE NUMBER(5)
PREREQUISITE VARCHAR2(100)


DESCRIBE is an SQL*Plus command and can be abbreviated to DESC.

Sunday, 3 July 2011

Displaying table definition using DESCRIBE

You can display the structure of a table using SQL*PLUS command DESCRIBE. It displays then name, datatype and whether the column can store null value for each column of the table.

The following is the syntax of DESCRIBE command.

DESC[RIBE] objectname

Displays the column definitions for the specified object. The object may be a table, view, synonym, function or procedure.


To display the structure of COURSES table, enter:

SQL> DESC COURSES
Name Null? Type
---------------------------------------------- -------- ----------
CCODE NOT NULL VARCHAR2(5)
NAME VARCHAR2(30)
DURATION NUMBER(3)
FEE NUMBER(5)
PREREQUISITE VARCHAR2(100)


DESCRIBE is an SQL*Plus command and can be abbreviated to DESC.