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 can 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;

.. almost everything – all external expectations, all pride, all fear of embarrassment or failure ~ these things just fall away in the face of death, leaving only what is truly important ~ Steve Jobs

Related Oracle 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


 
Copyright © 1999-2024 SS64.com
Some rights reserved