From the course: Oracle Database 19c: Advanced SQL

Unlock the full course today

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

WHEN NOT MATCHED . . . INSERT clause

WHEN NOT MATCHED . . . INSERT clause - Oracle Database Tutorial

From the course: Oracle Database 19c: Advanced SQL

Start my 1-month free trial

WHEN NOT MATCHED . . . INSERT clause

- [Instructor] On a daily basis, new data can be updated, deleted or inserted into existing tables. When the row appears to be new in your merge statement, use the WHEN NOT MATCHED clause. Here's what the MERGE statement looks like. The source of the merge can be a sub-query 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 match clause, you do an update with an optional Delete. When you use the not matched clause, you're inserting new rows. I'll focus on the when not matched clause in the following slides. Here's the employee updates table, which is a bit of a misnomer since it will actually be doing inserts, updates and deletes. I'll decide what to do with the row and employees based on the employee ID in the employee updates table. The next three columns provide an update to the first name, same last name or commission percent columns if the column is a no. The last column M delete, will delete the row in the…

Contents