Problem in doing MERGE

Hi,
I have a problem in using MERGE. Say if my table called "AtmosphericParams". The primary key is AtmosphericParamsId (auto-sequence) and the unique index is TileId.
If the existing table contains:
1 | 1 | <some data>
If my AtmosphericParamsTemp table contains:
1 | 2 | <some data>
2 | 2 | <some data>
My merge statement will fail - it is trying to do an insert on the first row, which violates the constraints.
Any recommendations?
Thanks!
MERGE INTO AtmosphericParams
USING ( SELECT * FROM AtmosphericParamsTemp ) Temp
ON ( AtmosphericParams.AtmosphericParamsId = Temp.AtmosphericParamsId AND
AtmosphericParams.TileId = Temp.TileId )
WHEN MATCHED THEN
UPDATE
SET AtmosphericParams.WaterVapour = Temp.WaterVapour,
AtmosphericParams.MeasuringDate = Temp.MeasuringDate
WHEN NOT MATCHED THEN
INSERT ( AtmosphericParams.AtmosphericParamsId,
AtmosphericParams.TileId,
AtmosphericParams.WaterVapour,
AtmosphericParams.MeasuringDate )
VALUES ( Temp.AtmosphericParamsId,
Temp.TileId,
Temp.WaterVapour,
Temp.MeasuringDate );

The problem here is that you have both the primary key and the unique key in your ON statement. You need to decide what you want to happen in this case.
If the existing table contains:
1 | 1 | <some data>
If my AtmosphericParamsTemp table contains:
1 | 2 | <some data>
Here the record tries to insert 1 | 2 but this violates the unique key on title id. If you only have the primary key in the ON statement then this will do an update. Or is the primary key meant to be the AtmosphericParamsId and the TitleID? You need to decide.

Similar Messages

  • Why my MacBook Pro cannot connect to any wifi networks while there was no problem to doing that in the past p?

    I used to connect wifi now I cannot. Why? Need to obtain new IP address and how ?

    Hi Ole, and a warm welcome to the forums!
    It could be a HW problem, but does it get many black bars in the Airport icon?
    See if this helps hers...
    Go to System Preferences
    Click Network
    Highlight AirPort and click Configure...
    Choose “By default, join: Preferred networks”
    Select her access point(s) and Remove all her access point with the minus button.
    Launch her keychain access in Utilities and delete her access point keychain entry.
    Reboot
    Go back to the “By default, join:” page and click the plus this time to add your access point. Enter the correct password, save, reboot.

  • I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5. I am receiving an error problem when doing the following -  I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive whe

    Hi, I am having a little trouble with exporting images to another drive and Catalogue and need some help if anyone can give me some advice
    I am currently using Lightroom 5.6 and operating on a Mac with OSX Ver 10.9.5.
    I am receiving an error problem when doing the following -
    I am exporting selected photos from a particular Catalogue saved on Drive 1 to a folder created on another Drive where a Lightroom Catalogue has been created. In this Catalogue I have arranged for the images once exported to be moved to a different folder - I used the Auto Import process under the File dialogue box.
    When processing the Export I receive an error message for each of the images being exported indicating the following -
    Heading Import Results
    Some import operations were not performed
    Could not move a file to requested location. (1)
    then a description of the image with file name
    Box Save As                                  Box  OK
    If I click the OK button to each image I can then go to the other Catalogue and all images are then transferred to the file as required.
    To click the OK button each time is time consuming, possibly I have missed an action or maybe you can advise an alternative method to save the time in actioning this process.
    Thanks if you can can help out.

    Thank You, but this is a gong show. Why is something that is so important to us all so very, very difficult to do?

  • I don't know of there is anyone than can fix this age old Apple problem.   Does anyone know how to retrieve things under an old Apple ID when the email used for that account no longer exists? I am trying to update a number of apps that was bought under an

    I don't know of there is anyone than can fix this age old Apple problem.   Does anyone know how to retrieve apps under an old Apple ID when the email used for that account no longer exists &amp; I can't remember the password? After speaking with Apple Acct. Security, I got the security Q right but my birthday was wrong! They wanted the serial number from my phone that was 3 iPhones ago! Seriously??!!
    Any updated way to work around this? No Apple people can correct it.
    Thanks,
    Joe

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (122986)

  • I installed new software updates, and now when I try to open up pages it tells me "Pages cannot be opened because of a problem." does anyone know what I can do?

    I installed new software updates, and now when I try to open up pages it tells me "Pages cannot be opened because of a problem." does anyone know what I can do?

    1)Copy this below from --{code} to --{code}
    --{code}
    set p2l to "" & (path to library folder from user domain)
    set the_cache to p2l & "Caches:com.apple.iWork.fonts"
    tell application "System Events"
              set maybe to exists disk item the_cache
              if maybe then delete disk item the_cache
    end tell
    if maybe then
              display dialog "I deleted the file :" & return & the_cache
    else
              display dialog "The file :" & return & the_cache & return & "was unavailable !"
    end if
    --{code}
    2) Than open Applescript Editor in your applications and paste it
    3) Than select "Compile"
    4) Than select "Run"

  • Problem while doing bdc for fv60

    Hi frends,
       I got problem while doing BDC for fv60 tcode.i have given
    header items:
    vendor number
    invoice date
    posting date
    amount
    item data:
    g/l acc no: 100000
    amount 1000 whatever
    these are all given in recording
    in recording after all giving this data if we click on park it is telling "parking not possibe duiring batch input".
    can any body tell me the process for recording shdb and after that in bdc how can we give multiple line items for fv60
    thanks,
    naveen.

    I don't think you can use FV60 in batch input. Your options are to use transaction FBV1 or bapi BAPI_INCOMINGINVOICE_PARK.
    Rob

  • On ipad 2 ps touch just keeps crashing it appears from reviews this is a common problem, how does one access a refund

    On ipad 2 ps touch just keeps crashing it appears from reviews this is a common problem, how does one access a refund

    As stated, completely exit pst (don't just leave the app) and then activate airplane mode. Then open PST and change your cloud sync option to "off". Once you deactivate airplane mode, you should be able to open PST again without the crash. Iirc, I had to work at opening PST and accessing my settings very quickly or it would still crash before opening the settings page. Unfortunately, we have to completely forget about cloud sync until the bug is fixed. Save any image files back to the ios camera roll to share with other apps or upload elsewhere.

  • HT204291 Airplay intermittent problem, why does not airplay work well anylonger?

    Airplay intermittent problem, why does not airplay work well anylonger. Suddenly it drops out. Now this function has gone from great to ****.
    Trying to view streamed content from the ipad to the Apple TV? Nah forget about it. Sooo dissapointing.

    Restart your wifi router

  • ESB problem when use merge function in master/detail relationship

    I have some problem with the merge function in database adapter.
    details:
    I have 2 tables in master/detail relationship, both have GUID column as a primary key (GUID generated by ESB).
    'car_group' table
    pk : guid
    unique : group_no, datadate, datatime
    ===============================
    guid, group_no, datadate, datatime, group_detail
    ===============================
    1, 1, 01/01/2008, 09:00, groupdetail01
    2, 1, 01/01/2008, 10:00, groupdetail02
    'car_group_detail' table
    pk : guid
    fk : car_group_guid link to car_group.guid
    ==================
    guid, car_group_guid, detail
    ==================
    1, 1, detail01
    2, 1, detail02
    3, 2, detail03
    4, 2, detail04
    I used a file adapter as a input, here is an example text file
    M, 1, 01/01/2008, 09:00, groupdetail01
    D, detail01
    D, detail02
    M, 1, 01/01/2008, 10:00, groupdetail02
    D, detail03
    D, detail04
    Because I used merge function so I need to specify the columns that will be a condition for the insert/update,
    but I have generate GUID as a primary key in the tables, I can't used it, so in toplink I map my unique key as a primary key.
    The insert operation work fine but when update is required (for example, try to change 'group_detail' column of the master table in text file),
    an SQLException thrown, the log file shown the adapter try to update the GUID column of master table but the constraint not allowed.
    And yes, cause of GUID generate everytime so ESB try to update this column also, but I don't want to do like that, I need something
    like when update operation required, just ignored the GUID column.
    I try to mark read-only to the GUID column in Toplink mapping file but still have the same problem, it still generate UPDATE statement
    with the GUID column, and also I try to let the database trigger to generate GUID instead of ESB function, but it not works in master/detail
    relationship (I think the Toplink manage the relationship, is it right ?)
    Please advise, thanks for advance.

    somebody please help, thanks !!!

  • How does Merged Dimensions Work in WebI created on SAP BI Queries

    Hi,
    I need to know how does Merge dimensions work in WebI when using SAP BI Query as source?
    Below is my understanding when connection is defined for the universe on oracle database:
    1) To get the data in merged dimensions, there must be physical join (Either Direct or vai some other tables) between different tables at backend level (This means  there  must be join between tables in Oracle database.)
    2) we get the UNION of data when dimensions are merged at webI level.
    I dont know how this works in SAP BI.
    Since there is different data model defined for different BI Queries in SAP , and for each BI Query and there is seperate Universe, So how can you get correct data in WebI when there is no connections in DSO's used in different BI queries?
    Can any one suggest me the way data apperas in merged dimensions for WebI created on SAP BI?

    I assume we are only talking about merging dimensions in Web Intelligence here and not on the BW backend. this is a client side mere where you have 2 resultsets.
    if you want to do this on the BI server side it would be a multi-provider combining different InfoProviders - or a InfoSet - depending on the join type you need. MultiProvider is a union, Infoset allows you to choose
    Ingo

  • Problem while doing PGI for Returns Delivery

    Hi,
    We are facing some problem which doing PGI for a returns delivery. Our scenario is HU and WM managed. After creation of delivery I have created a TO and has two different valuation type of same material. Total quantity in TO is 2, 1 of each valuation type. So, automatically, batch split happened for the line item in delivery.
    Now when I am trying to do PGI for this delivery, I get en error message saying "Enter Valuation Type". The movement type used here is 161 (Vendor Returns)
    Same thing is happening successfully for movement type 643 (Transfer inter company code).  What I can gather is that while creating 161 document against delivery system is not automatically taking the valuation types mentioned in line item of delivery.
    Let me know possible reasons for this error and resolution.
    Regards,
    Vishal

    Implement the OSS note 965985

  • Hi, I wish to buy an Adobe Master Collection CS3 (Corporate Edition) from someone in the US and I hope to use it in the UK. Does anyone know if this can be done without any problems, also does Adobe still allow people to register the CS3 Corporate Edition

    Hi, I wish to buy an Adobe Master Collection CS3 (Corporate Edition) from someone in the US and I hope to use it in the UK. Does anyone know if this can be done without any problems, also does Adobe still allow people to register the CS3 Corporate Edition? any help would be greatly appreciated

    The flaw is here:
    corporate edition
    ...which essentially means it's most likely a volume license and thus not transferable in the first place. The rest is as Steve said - buying software on eBay is risky even on the best of days.
    Mylenium

  • Help. Photoshop CC14 on Mac 5k (2014) running Yosemite 10.10.1. Photoshop stops responding when I'm opening files, saving files or creating new ones. Is anyone suffering the same problem? Does anyone have an answer?

    Help. Photoshop CC14 on Mac 5k (2014) running Yosemite 10.10.1. Photoshop stops responding when I'm opening files, saving files or creating new ones. Is anyone suffering the same problem? Does anyone have an answer?

    First, go install the MacOS 10.10 updates - you should be on 10.10.2.
    I haven't heard of Photoshop not responding during opens and saves.  Does it stop responding while the open/save dialogs are visible, or while Photoshop is actually reading or writing files?
    10.10.1 did fix a crash in the open/save dialogs, but 10.10.2 still has some odd issues (mostly program errors coming from the OS code) in the open/save dialogs.

  • Punch in problem-Why does cycle mode activate and snap to somewhere else when I set up a punch?

    Punch in problem-Why does cycle mode activate and snap to somewhere else when I set up a punch?

    Because whoever programmed it must be ********, I've dealt with this issue long enough.  I've sent Apple feedback on this issue long ago and nothing has been done yet.  The only work around is to try and remember that every time you double click in the punch line to hit the c button to turn it off before you start recording or you have to drag your punch line around all the time, what a pain in the ***.

  • I have problems printing with a HP Officejet 6500 printer directly from my iMac. The printer itself does function well, as I can print from another PC without any problems. Does anyone have a clue?

    I have problems printing with a HP Officejet 6500 printer directly from my iMac. The printer itself does function well, as I can print from another PC without any problems. Does anyone have a clue?

    Hello:
    I must apologize  .  I should have checked here first:
    http://support.apple.com/kb/HT3669#HP
    According to the list, there is no driver for your printer included in OS X 10.7.
    There are a couple of options:
    1.  Contact HP to see if they have a workaround.
    2. If the model of printer is not listed but your printer is a PostScript printer or PCL Laser printer, try the "Generic PostScript" or "PCL Laser printer" drivers.  Generic printer drivers may not let you access all the features of your printer.
    I have not tried #2, but some people have had success.
    Barry

Maybe you are looking for