ORACLE: DELETE [EN]
top of page
CerebroSQL

Oracle:

DELETE

DELETE [ hint ]
[ FROM ]
{ dml_table_expression_clause
| ONLY (dml_table_expression_clause)
} [ t_alias ]
[ where_clause ]
[ returning_clause ]
[error_logging_clause];

DML_table_expression_clause::=
{ [ schema. ]
{ table
[ partition_extension_clause
| @ dblink
]
| { view | materialized view } [ @ dblink ]
}
| ( subquery [ subquery_restriction_clause ] )
| table_collection_expression
}
partition_extension_clause::=
{ PARTITION (partition)
| PARTITION FOR (partition_key_value [, partition_key_value]...)
| SUBPARTITION (subpartition)
| SUBPARTITION FOR (subpartition_key_value [, subpartition_key_value]...)
}
subquery_restriction_clause::=
WITH { READ ONLY
| CHECK OPTION
} [ CONSTRAINT constraint ]
table_collection_expression::=
TABLE (collection_expression) [ (+) ]
where_clause::=
WHERE condition
returning_clause ::=
{ RETURN | RETURNING } expr [, expr ]...
INTO data_item [, data_item ]...
error_logging_clause ::=
LOG ERRORS
[ INTO [schema.] table ]
[ (simple_expression) ]
[ REJECT LIMIT { integer | UNLIMITED } ]

Example

DELETE FROM product_descriptions
WHERE language_id = 'AR';

DELETE FROM employees
WHERE job_id = 'SA_REP'
AND commission_pct < .2;

DELETE FROM (SELECT * FROM employees)
WHERE job_id = 'SA_REP'
AND commission_pct < .2;

DELETE FROM hr.locations@remote
WHERE location_id > 3000;

DELETE FROM sales PARTITION (sales_q1_1998)
WHERE amount_sold > 1000;

DELETE FROM employees
WHERE job_id = 'SA_REP'
AND hire_date + TO_YMINTERVAL('01-00') < SYSDATE
RETURNING salary INTO :bnd1;

bottom of page