• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Insert/Update if no record there

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a table with a primary key that has three columns. I am taking data from an outside source and need to insert the data into the table. Data in the record set could be updated later in the dataset. If it is not there I want to do an insert, if the primary key is already in the table I would like to update the remaining values. Is there a simple update to use that if the record is not there it adds it, I would not like to try an insert and then update if a pk error is thrown? To much error overhead in processing. If any could lend an insight that would be great.

Jeremy
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Oracle 9i, there is a new command called Merge, which either inserts or updates. Check it out.

I think this replaces the old UPSERT statement, which I don't think is ANSI standard.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic