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


Please Help Members By Posting Answers For Below Questions

What is an oracle table?

558


What is bulk copy or bcp in oracle?

611


How to connect the oracle server as sysdba?

633


How many types of database triggers exist?

578


How to define an external table with a text file?

579






Can we use bind variables in oracle stored procedure?

492


How to pass a cursor variable to a procedure?

562


How to assign a table row to a record variable?

583


How to start a specific oracle instance?

584


Explain integrity constraint?

647


What is recovery manager(rman) backup in Oracle?

629


What is an oracle wallet?

516


Explain the dml?

602


What are the types of partitions in oracle?

543


State the various uses of dbcc command?

551