how to UPSERT (update or insert into a table?)

Answer

createor replace
procedure ups(xa number)asbeginmergeinto mergetest m using dual on(a = xa)whennotmatchedtheninsert(a,b)values(xa,1)whenmatchedthenupdateset b = b+1;end ups;/droptable mergetest;createtable mergetest(a number, b number);
call ups(10);
call ups(10);
call ups(20);select*from mergetest;

All oracle Questions

Ask your interview questions on oracle

Write Your comment or Questions if you want the answers on oracle from oracle Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---