Table Has C1 And C2 Column If Exits any record in c1 then
Update c2 record Otherwise insert new record in the C1 And
C2 (Using Procedure)
Answer Posted / ron
use oracle's new feature called upsert :
merge t1
using (select * t1) t2
on (t1.col1=t2.col1)
when matched then
update set col2='value'
when not matched then
insert into (col1, col2) values ('val1', 'val2');
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How can we delete duplicate rows in a table?
1) What is ONE_SIZE_FITS_ALL approach? 2) Explain the Common & Variable Header of DATA FILE? 3) What are the Drawbacks to using OMF DB? and the Advantages? 4) List out the Advantages of Undo T.spaces over the Undo SEGMENT? 5) Difference between the Temporary tablespace with TEMPFILE and the Tablespace with TEMPORARY Keyword? 6) What are the situation extents are freeing for reuse.
Explain index?
What are the various constraints used in oracle?
How to resolve the ORA-39133 error in Oracle?
How to run create database statement again?
How to convert characters to numbers in oracle?
What is the difference between sharding and partitioning?
What is the sql query to concatenate column values from multiple rows in oracle?
What is recovery manager(rman) backup in Oracle?
How do I uninstall oracle client from windows?
Can we store images in oracle database?
Please explain oracle data types with examples?
what is the scenario where you take the database to NoArchivelog mode?
In oracle there is column command, how will you explain that?