From the course: Oracle Database 19c: Advanced SQL

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

DELETE clause

DELETE clause - Oracle Database Tutorial

From the course: Oracle Database 19c: Advanced SQL

Start my 1-month free trial

DELETE clause

- [Instructor] The MERGE statement combines all three of the DML statements you already use quite often: Insert, update and delete or two out of three of those, or even just one of those. Here's the syntax for MERGE. As with any DML statement, you specify the table you wish to update, insert into or delete from within to. The source of the MERGE can be a subquery or just a plain table. When rows match using the ON clause, it's actually doing a join between the two row sets. Within the MATCHED clause, you do an update with an optional delete. If you provide the NOT MATCHED clause, you're inserting new rows. Let's focus on the optional DELETE WHERE clause. Notice that I've highlighted both the UPDATE SET and DELETE WHERE clauses in the syntax. Here's the EMPLOYEE_UPDATES table, which in this case we'll do some DELETEs. The last column EMP_DELETE, we'll delete the row in the target table if it's value is Y. One thing to note are some possible anomalies in the EMPLOYEE_UPDATES table, when…

Contents