Home Oracle Commands

DELETE Statement

Delete rows from a table, or view.

Syntax:

   DELETE [FROM] [schema.] table [@dblink] [alias]
      WHERE (condition)
         [RETURNING expr INTO DATA_ITEM]

   DELETE [FROM] [schema.] table [SUB]PARTITION partition [alias]
      WHERE (condition)
         [RETURNING expr INTO DATA_ITEM]

   DELETE [FROM] [schema.] view [@dblink] [alias]
      WHERE (condition)
         [RETURNING expr INTO DATA_ITEM]

   DELETE [FROM] subquery [WITH READ ONLY] [alias]
      WHERE (condition)
         [RETURNING expr INTO DATA_ITEM]

   DELETE [FROM] subquery [WITH CHECK OPTION] [CONSTRAINT constraint] [alias]
      WHERE (condition)
         [RETURNING expr INTO DATA_ITEM]

To improve performance, you may also add a hint to any of the above... DELETE hint FROM Schema.table...

Example:

The following example returns column es_salary from the deleted rows and stores the result in bind array :1

DELETE FROM t_employee_salary
WHERE es_emp_id = 1075 AND es_commission = 50 
RETURNING es_salary INTO :1;

Related Commands:

INSERT
SELECT

TRUNCATE

UPDATE

Related Views:

 DBA_SNAPSHOTS        ALL_SNAPSHOTS        USER_SNAPSHOTS
 DBA_ALL_TABLES       ALL_ALL_TABLES       USER_ALL_TABLES
 DBA_TABLES           ALL_TABLES           USER_TABLES         TAB
 DBA_VIEWS            ALL_VIEWS            USER_VIEWS
 DICTIONARY
 DICT_COLUMNS

Equivalent SQL Server command:

DELETE



Back to the Top

Simon Sheppard
SS64.com