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.

WHEN MATCHED . . . UPDATE clause

WHEN MATCHED . . . UPDATE clause - Oracle Database Tutorial

From the course: Oracle Database 19c: Advanced SQL

Start my 1-month free trial

WHEN MATCHED . . . UPDATE clause

- The merge statement is great because you can use it when you're not sure whether the source table has inserts, updates or deletes. I'll show you the high level syntax. And in this lesson, more details of the when matched clause here's the general format of the merge statement. The source of the merge can be a sub query or just the playing 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. I'll focus on the one matched clause in the following slides. Here's the employee updates table which can have 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, last name, or commission percent columns. If the column isn't no the last column M delete we'll delete the row in the…

Contents