How to upsert (update or insert into a table)?
Answer / Manmeet Singh
Oracle doesn't have a built-in UPsert statement like some other databases. Instead, you can create a MERGE statement that performs an update if the record exists and an insert if it doesn't. Here is a basic example: `MERGE INTO EMPLOYEES t TARGET USING (SELECT * FROM another_table) s ON (t.employee_id = s.employee_id) WHEN MATCHED THEN UPDATE SET column1 = s.column1, column2 = s.column2 WHEN NOT MATCHED THEN INSERT (column1, column2) VALUES (s.column1, s.column2);`
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the different types of database objects?
How to create an initialization parameter file?
How do I limit the number of oracle database connections generated by weblogic server?
Explain the characteristics of oracle dba?
What types of joins are used in writing subqueries?
What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?
What is a cluster?
What are the execution control statements?
What is an oracle and why it is used?
What is truncate oracle?
1.how to extract the second highest salary from emp table having sal as a column which contains the salary of all employee of an organisation.
what is the syntax of DROP command?