You can do this in one expression with the Oracle MERGE statement:
MERGE DestinationTable target
USING (
Select 'Briggs' Author, 'My Next Master' Title, 6 Popularity
Union All Select 'Millis', 'Man up, Nut head', 3
) Z
ON Z.Author = target.Author
And Z.Title = target.Title
WHEN MATCHED THEN
UPDATE SET target.Popularity = Z.Popularity
WHEN NOT MATCHED THEN
Insert(Author, Title, Popularity) Values(Z.Author, Z.Title, Z.Popularity);
Oracle MERGE statement
source
share