Oracle DDL Commands


The COMMENT Command

COMMENT adds comments to table, view or column-level data dictionary objects.

COMMENT ON COLUMN <tablename>.<columnname> IS 'This is a comment';

The DESCRIBE Command

The DESCRIBE command allows description and display of database object structure.

DESC[RIBE] [<user_name>.]<table_name>

Below is an example of the DESCRIBE command.

SQL> describe emp;
 Name                            Null?    Type
 ------------------------------- -------- ----
 EMPNO                           NOT NULL NUMBER(4)
 ENAME                                    VARCHAR2(10)
 JOB                                      VARCHAR2(9)
 MGR                                      NUMBER(4)
 HIREDATE                                 DATE
 SAL                                      NUMBER(7,2)
 COMM                                     NUMBER(7,2)
 DEPTNO                                   NUMBER(2)

Another interesting command of similar ilk to that of the DESCRIBE command is the DEFINE command as shown in the example below.

SQL> define test = number;
SQL> define test;
DEFINE TEST            = "number" (CHAR)

TRUNCATE

The TRUNCATE command allows deletion of records from a table without logging and thus is faster than a delete command but is also non-recoverable, ie. TRUNCATE cannot be rollback back. Also TRUNCATE preserves table structure as opposed to dropping the entire table.

SET TRANSACTION

The SET TRANSACTION command affects the current session (user) transaction and any settings set are removed when a COMMIT or ROLLBACK is issued.

Other SQL Commands