This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 29237
    
139

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle merge same table
 
Similar Threads
How to restrict user marking same events in multiple times.
Multi-row insert
Generating Huge Table
Trigger Function Problem
[JPA] merge() is inserting instead of updating