Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Oracle/OAS and the fly likes Oracle merge same table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Oracle merge same table" Watch "Oracle merge same table" New topic
Author

Oracle merge same table

Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
Hi,

All, is it possible to use Oracle merge query within the same table.
Case is

1. Select if input.x and input.y combination exists in Table A
2. If a row exists update column C in Table A with inout.Z
3. If row doesnt exist insert the row

Can anyone provide me how to do this using merge ?

I wrote a procs to do this but believe a merge can handle it

Thanks
Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
could anyone please help

Thanks
Atul
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

Do you know how to merge two different tables into one? If so, you know the syntax and are all set up to try it and find out.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Vamsi Mohan
Ranch Hand

Joined: Jun 20, 2009
Posts: 80
You can use "insert with select" query to merge the records.


VAMSI MOHAN.V
(SCJP5.0, IBM Rational Solution Designer, IBM Rational Architect, IBM RUP Designer)
Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
I am afraid I may need a little more help.
I have only done merge query which merges two tables.

Thankyou
 
 
subject: Oracle merge same table