With the help of MERGE for update and insert a table

-Oracle 11 g
-Windows 2008

I'm working on a script which requires update on insertion according to requirement.

I table_a in the Test database and table_b in a Production environment and want to sync database availability.
I need help to place the dblink (where to put it etc.).
Here's what I've got so far:

/ * Update the tables for the production of Test environment
November 28, 2011
*/

FUSION
in prod.tbl_link P
using (select * from test.tbl_link) T
On(prod.tbl_link.link_id = test.tbl_link.link_id.ID)
When matched then
Update
Set P.LINK_ID = T.L_LINK_ID,
P.L_URL = T.L_URL =,
P.L_TITLE = T.L_TITLE,
P.L_DESCRIPTION = T.L_DESCRIPTION,
P.ISSUE_DATE = T.L_ISSUE_DATE,
P.PUBLICATION_DATE = T.L_PUBLICATION_DATE,
P.LAST_MODIFIED_DATE = T.L_LAST_MODIFIED_DATE,
P.L_ICON_NEW = T.L_ICON_NEW,
P.L_ICON_RECENT = T.L_ICON_RECENT,
P.L_ICON_NEW_FROM_DATE = T.L_ICON_NEW_FROM_DATE,
P.L_ICON_NEW_TO_DATE = T.L_ICON_NEW_TO_DATE,
P.L_ICON_RECENT_FROM_DATE = T.L_ICON_RECENT_FROM_DATE,
P.L_ICON_RECENT_TO_DATE = T.L_ICON_RECENT_TO_DATE,
P.ACTIVE_FLAG = T.ACTIVE_FLAG,
P.MODIFIED_BY = T.MODIFIED_BY,
P.MODIFIED_DATE = T.MODIFIED_DATE,
P.CATEGORY_ID = T.CATEGORY_ID,
P.SUBCATEGORY_ID = T.SUBCATEGORY_ID,
P.SUBJECT_ID = T.SUBJECT_ID,
P.STATUS_ID = T.STATUS_ID
When not matched then
Insert (P.LINK_ID,
P.L_URL,
P.L_TITLE,
P.L_DESCRIPTION,
P.L_ISSUE_DATE,
P.L_PUBLICATION_DATE,
P.L_LAST_MODIFIED_DATE,
P.L_ICON_NEW,
P.L_ICON_RECENT,
P.L_ICON_NEW_FROM_DATE,
P.L_ICON_NEW_TO_DATE,
P.L_ICON_RECENT_FROM_DATE,
P.L_ICON_RECENT_TO_DATE,
P.ACTIVE_FLAG,
P.MODIFIED_BY,
P.MODIFIED_DATE,
P.CATEGORY_ID,
P.SUBCATEGORY_ID,
P.SUBJECT_ID,
P.STATUS_ID)
values (T.LINK_ID,
T.L_URL,
T.L_TITLE,
T.L_DESCRIPTION,
T.L_ISSUE_DATE,
T.L_PUBLICATION_DATE,
T.L_LAST_MODIFIED_DATE,
T.L_ICON_NEW,
T.L_ICON_RECENT,
T.L_ICON_NEW_FROM_DATE,
T.L_ICON_NEW_TO_DATE,
T.L_ICON_RECENT_FROM_DATE,
T.L_ICON_RECENT_TO_DATE,
T.ACTIVE_FLAG,
T.MODIFIED_BY,
T.MODIFIED_DATE,
T.CATEGORY_ID,
T.SUBCATEGORY_ID,
T.SUBJECT_ID,
T.STATUS_ID)

You cannot update the same column that is used in the join.

The error is been derived from here:
on (t.status_id = s.status_id)

http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:556373000346392260

Tags: Database

Similar Questions

  • With the help of Merge for Update, Insert, Update and also to delete outdated records

    Hi all!!!

    Suppose that a credit memo the following table called Orders:
    ORDERID        STATUS      PRICE 
    ---------- ---------- ---------- 
             1          0        100 
             2          0        200 
             3          0        300 
             4          0        350 
             5          0        390
    In addition, there are a procedure that will generate data on a global temporary table, called Orders_Temp. This temporary table will be used to update the Orders table. + commands + have a trigger that will perform different operations when an Insert, Update, or Delete command is executed.

    Consider the table of Orders_Temp to have the following data after you run a procedure that is responsible for the update of order data:
    ORDERID        STATUS      PRICE 
    ---------- ---------- ---------- 
             1          1        100 
             2          2        200 
             3          0        300 
             5          0        390 
             6          0        350
    As you can see, orders 1 and 2 have been updated. Order 3 and 5 were intact, order 4 has been deleted and command 6 inserted. Fusion will take care of properly manage orders 1, 2, 3, 5 and 6, although producing an update of order 3 and 5, which have not changed.

    So, here are the questions:
    (1) how could remove the 4 arrestedorder, as this order was not present on Orders_Temp? Is it possible to use the merge command to do this?
    (2) is it possible to generates not a update operation for orders of 3 and 5, which have not changed?

    I m using Oracle 10.2 SE.

    Thank you very much!
    Regis

    Hello

    Please try this. Not tested! with 9i. I think you can do this by using the union all.

    MERGE INTO orders tgt
     USING (SELECT A.*, 1 mask
              FROM orders_temp A
            UNION ALL
            SELECT A.*, 0
              FROM orders A
             WHERE NOT EXISTS
                     (SELECT 1
                        FROM orders_temp b
                       WHERE A.order_id = b.order_id)) src
        ON (tgt.order_id = src.order_id)
    WHEN MATCHED
    THEN
      UPDATE SET tgt.status = src.status, tgt.price = src.price
         WHERE src.mask = 1
           AND tgt.status != src.status
           AND tgt.price != src.price
      DELETE
         WHERE src.mask = 0
    WHEN NOT MATCHED
    THEN
      INSERT VALUES (src.order_id, src.status, src.price)
    

    or you could try to use a full outer join and treat NULL values.
    G.

    Edited by: g. March 8, 2011 11:17

    changed to the Union all the

  • With the help of Vlan for LAN and DMZ

    Hello

    For the moment, I have assigned my LAN and DMZ networks to two separate network card (so therefore no Vlan tagging)

    for example vmnic0 = LAN, vmnic1 = DMZ.

    It works well but I like to make changes in the way I want to use two separate physical network adapter and use on the two s two LAN and DMZ nic but now using the VLAN.

    So think of this configuration:

    For each network, I create a Vswitch, in order to obtain a Vswitch named VsLAN, VsDMZ for the case.

    The Vswitch I attribute a two nic Nic will be the day before. as vmnic0, vmnic2 (at rest)

    This Vswitch I create a port group and assign the correct number of VLan as LAN 10 and 20 to the DMZ.

    Create the another Vswitch will have the same Nic but now vmnic0 will be the stanby one.

    Probalby all great so far I think or not?

    Issues related to the:

    -Well this concept where there is a relationship a Vswitch and port group or a switch with multiple exchanges?

    In case a Vswitch with multiple port groups I will assign to group level reserve and the active NIC Port.

    -If I create a group of ports and assiging several Vlan IP packets received by the virtual machine itself also be labelled or not identified?

    Other words. Do I need to configure the NETWORK adapter to the virtual machine also for the same local network ID virtual or not.

    Thanks for your comments.

    Hello

    Change of vlan is a pretty good idea to get the failover and the performance of the network LAN and DMZ. You have confused somewhat however concepts.

    A can only be used in a vSwitch vmnic. So what you want to do is the following:

    Create a vSwitch

    On the vSwitch create two ports: LAN (vlan10), DMZ (vlan20)

    If vmnic0 and vmnic1 have access to the vlan10 and 20, then simply add the two vmnic virtual switch. By default, they will both be active and that's fine. If you do not want to CHANGE the GRPE ports LAN and goto the "failover" tab and put vmnic0 as active and vmnic1 as before. Then do the reverse on the DMZ port group.

    Best regards

    Frank Brix Pedersen

    blog: http://www.vfrank.org

  • With the help of AUSST - latest updates of Adobe CC 2014 are not uploaded to the server - how to solve this problem?

    With the help of AUSST - latest updates of Adobe CC 2014 are not uploaded to the server - how to solve this problem?

    I tried both incremental and train to do a fresh install (. / AdobeUpdateServerSetupTool - root = "/ serverroot/updates / Adobe / CS '-fee)

    If anyone can answer this - please let me know.

    Hi Mark,

    Try to refresh the web server and run the AUSST with cool switch. In addition, please make sure that you have enough disk space available in the location of the server.

    Thank you

    Ashish

  • How to create the ISO image of windows 8 with the help of boot, efi, sources, and support files

    Hello
    I followed folders in my USB key:

    Boot
    EFI
    Sources
    Support,

    and the following files:

    Setup
    Bootmgr.EFI
    Bootmgr

    How can I create an ISO image of windows 8 with the help of these files and folders. I even installed ADK, but I couldn't keep up with it.
    I would be very grateful if someone could help me out here.

    Secondly, I would also like to know how to create a system image of WINDOWS 8, where the hard drive breaks down.

    Concerning
    MAK

    If you have the upgrade key, go here

    http://Windows.Microsoft.com/en-us/Windows-8/create-reset-refresh-media

    You can go for the use of win8 / win7 / vista to match highlights you want - and download the win8 installation and run the installation with your key to download you need to install windows from that.  Will allow you to have an iso bootable.

    Make a picture of the control panel system / Windows 7 file recovery / system Image.  I certainly wouldn't put it on dvd.  It will be too.   Find an old preference portable hard drive and buy a $ 20 usb box, get an external hard drive.

  • With the help of & quot; contains & quot; and it does not work for me.

    Hey everybody, thanks for your help. Here's what I'm trying to do:

    < cfif #address # contains "Washington" > you can not access this site. < other > access granted. < / cfif >

    I want to be able to have my site perform certain actions based on the street, that the person feeds. They enter their address in a form, that information is then verified when they submit. If they enter 1234 Washington Street, I think that the above line would be that Washington contained in this string. I tried several times and have had no luck.

    Any suggestions?

    Thanks for the help. I understood where the problem was. This is the problem by trying to fix the bugs of programmers on drugs... lol

    The problem is in the code it says .

    What was going on in this code was just after the definition of the error, the code then was

    Your suggestions help me to find this because I tried both of your suggestions and none worked so I thought, there is something wrong in this code.

    In any case, thanks for you help.

  • Concerns about the workouts with the Apple Watch - request for comments and Suggestions

    I'm a professional skill that has recently upgraded from a Polar to the Apple Watch.  I am delighted to stop wearing the chest strap of the Polar, but even though I love my new watch, I wish for some improvements in the future.  Training categories are too vague.  When you set up a 'training' on my Apple Watch, which is the step class, I was ANOTHER selection to OPEN.  Others who do?  What others recommend?  And I'm trying to decide whether to use Active or Total calories during the recording of my activities in my Fitbit dashboard.  One last thing, I find it odd to be worked hard and look down to see my heart rate displayed as 60, when I know that it takes more than 130.  I would like to hear from other fitness in mind of people about my problems.  Thank you.

    Hello

    When a workout is started, choose the type of activity that best fits the nature of your exercise activity. For any activity other than the named options, select the other (for example, your step class).

    The types of activities in the application of the workout on Apple Watch help the watch to determine what sensors / data sources to use in follow-up and evaluate the results of your activity. For example:

    -To run in the open air, the watch can use the heart rate sensor, accelerometer integrated and GPS of the iPhone paired (if it is available during the race).

    -For inside running (on a treadmill), the watch will be based on the accelerometer to estimate the distance and pace (as GPS data are not relevant).

    -Indoor activities, the watch will be based mainly on the frequency heart readings to estimate of burning calories.

    The other category is therefore useful (from point of view of the watch) by advising that certain types of activities are not undertaken.

    During the follow-up of one exercise using the others, your watch will estimate active calories based on one that is the higher of:

    -L'equivalent of a brisk walk (calories saved on this basis can vary per person, based on their personal information), or;

    -The data recorded by the heart rate sensor.

    When you use the other, activity app will also credit the ring of progress of exercise with one minute for every minute of the workout.

    If you want Apple to consider adding specific types of additional activities for the purpose of the workout, you can suggest that here:

    https://www.Apple.com/feedback/watch.html

    All submissions are read (even if you do not expect to receive a response).

    More information:

    Use of the workout on your Apple Watch - Apple Support

  • With the help of Max for alphanumeric values

    Currently I have a column varchar2 with the following data
    NPT_Code
    NPT00001
    NPT00112
    NPT03019A
    NPT00419
    Try to find a way to remove all the letters and get the next highest value increase.

    Numbers are always set to 5. Letters from there always 3 to the left. and sometimes, there is a letter to the right.

    I was going to mak a sequence and manually to the search for the greatest number in this column and just start from there, but I was wondering if anyone else knows another solution that uses max or something simliar.
    Select Max(NPT_Code) + 1 into l_NPT_CODE FROM TABLE
    
    UPDATE TABLE
    SET NPT_CODE = L_NPT_CODE
    WHERE ID = XXXX;

    Hello

    Here's one way:

    SELECT     TO_NUMBER ( REGEXP_SUBSTR ( string_column
                              , '[[:digit:]]+'
                          )
                )     AS number_value
    FROM    table_x
    ;
    

    number_value will be the number 3019 if string column is one of the following strings:
    NPT03019A
    NPT03019
    T03019
    03019NPT
    NPT3019A
    NPT0000003019A
    03019
    3019

    You can then use number_value functions such a MAX.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

  • With the help of AfterInsertTrigger for the audit table

    Hi all

    I use after Insert trigger to re - write the record goes to the base table in the corresponding table. The statement from the two tables are the same, except that the table has a column more - audit_time. Here is how I defined the trigger:

    Create or replace trigger dup_rec after insert on table_A for each line
    begin PK_comm.create_audit_rec (table_A, table_b,: new.) ROWID); end;


    In the PK_comm package, I defined the procedure as 'PRAGMA AUTONOMOUS_TRANSACTION' create_audit_rec as follows:


    Procedure create_audit_rec (baseTable IN VARCHAR2, auditTable IN VARCHAR2, cRowId IN VARCHAR2)
    IS
    PRAGME AUTONOMOUS_TRANSACTION;

    Insert into auditTable (audit_time, col1, col2, col3)
    Select systimestamp, col1, col2, col3
    from baseTable
    where ROWID = chartorowid ('v_rowID');

    It seems that registration is NOT added to the audit table when I tried to insert a record in the database table. Is it possible that integration into baseTable have not completed when the trigger is activated? If Yes, what is the work around?

    Thanks for your help,

    Mike

    Packages have session scope. Thus, each session will have a different instance of the collection.

    If you have multiple tables, you must in general, several collections. If you can guarantee that a single table would never change during the scope of a single statement, you could get away with a single collection. But as soon as a trigger on table A changes data in table B, you would need different collections. For most applications, it is much easier to simply create separate collections. I guess you can also create a collection of objects and folders that have a table name and a ROWID as well and add the logic to process only the associated with the table ROWID that you are interested in.

    Justin

  • With the help of PHP when SSI and JS are not allowed

    Hello

    I'm new to DW, but I am going through the lessons of the IPC to get up to the level 'standard user '.

    I want to use the Spry menu and other features defined in the IPC, but the hosting service I have used do not have the Server Side Includes or script.  The only authorized script language is PHP 4/5.

    I understand that there may be a way to put the generated Spry JS in a PHP file as part of the Web site.  For the moment, I'm just the lessons of the IPC so I do not have an obligation to use the features of PHP SQL.  Is there some documents/tutorial that I can use to get around this challenge?

    Thank you

    aim9x

    You do something wrong. Your host has no control over any javascript code on the client that you have on your pages side. If this does not work, it is not because of the accommodation. At this point, it might help to provide us with the url so we can see what is exactly the problem.

    And if they do not support SSI (which is hard to believe), then you can still use php include.

  • With the help of loudspeakers for live computer with microphone input.

    I read on here about the same problem I have but the response has been way off topic so had to ask here again. In windows XP, I could connect my microphone in my laptop and could hear myself in through computer speakers. I want to be able to do the same thing in windows vista. Can someone help me?

    Hi drwaseem,

    Welcome to Windows Vista answers Forums!

    You must Activate the Microphone

    1. connect the microphone to the computer.

    2. click on Start->-> Accessories for all programs, and then select Sound Recorder.

    3. click Start Recording (the red circle) and speak into the microphone.

    4 Recording tab showing a signal detected for the Microphone device

    Note: must have green check mark on that Microphone icon. If there is no checkmark, it means it is disabled.

    To activate the Microphone, right click on Microphone and click Activate. If you don't see the Microphone in the list, right-click on the white space and select devices see the disabled. Then, you'd see the Microphone. However, if you don't see the green check mark on it, right-click on it and click Activate. And also to select the Microphone and click on set as default (if defined as default button is active).

    For more information, you can consult the following link:

    http://Windows.Microsoft.com/en-us/Windows-Vista/connect-a-microphone-music-player-or-other-audio-device-to-your-computer

    Hope this information is useful.

    Jeremy K

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • With the help of QProperty for a label inside the list view

    Hello

    I wanted to assign the value of a label in the list view to a string QPROPERTY. I did it using Qt.myname = _app. QPropertyName. And Qt.myname attributed to label.

    It updates correctly during installation. But if I change the value, it is not updated within the display list, but working in another label that is outside the view of the list.

    It works for me

            ListView {
                property string myCppProperty: app.cppProperty
                listItemComponents: [
                    ListItemComponent {
                        Container {
                            id: listItemContainer
                            Label {
                                text: listItemContainer.ListItem.view.myCppProperty
                            }
                        }
                    }
                ]
            }
    
  • With the help of DAC for running no BIApps infa jobs n 2 EP running in parallel

    Hello

    We already have configuration BI Apps prod environment using DAC, Informatica and OBIEE 11 g for one of our customers.

    Now, we want to check the possibility of using the DAC for the execution of BIApps no informatica related jobs.
    (That we had only a week of the execution plan of DAC weekend and Informatica and DAC are inactive most of the time during the week)

    Customer wants a separate new small datamart be configured which meet the requirements of statement for different departments and has no links of kinship or any link with existing BI Data Warehouse applications.

    I just wanted to check if it will violate the license terms (if we use CAD to workflows not BI Apps and run another EP)?

    In addition, the DAC Build 10.1.3.4.1 is capable of running two parallel execution plans?

    We have heard long back that two parallel feature EP will be lunched in the version 11g CAD. Pointers or new in this space?

    Thanks in advance,

    From what I remember, you cannot load a 'distinct' DB instance that is NO OLIVIER. If you create a small custom datamart on the INSIDE of the OLIVIER exitsing schema, then it is acceptable. However, if you use DAC (no matter if its plan one or two plans) to load a NON-OBIA target, this may violate the license agreement. You need a self-contained separate license for Informatica and use the planner of Informatica tool. If you want to use DAC, ensure that your target is inside the DW OBIA.

    Pls correct brand...

  • With the help of DVT for the anonymous user

    Hello

    Can we use DVT for customization of the user interface for the anonymous user, I need to use the PST with the user offline. Please let me know if there is a way to do

    Kind regards
    Sylvie

    Hi Sarah,.

    Not really, no. If the user is anonymous, the portal framework has no way to keep the changes he made in the database, because they cannot be associated with a single user.

    If you really want, you could automatically connect to a pre-defined user (aka. a user with the name "anonymous"). However, since everyone could be connected to the same user, changes made by anyone would be seen by everyone and users might be undo/redo each and other changes constantly.

    George

  • Presented with the download page empty for update of Flash Player 13

    I tried to upgrade to Flash 13, but every time I get to the download page (http://get.adobe.com/flashplayer/) the images on the page are disappearing and I'm left with a blank page.

    I need to update this - what's happening on Earth? I hope someone can help?

    I use Windows 8 64-bit with bang up to date Firefox. I disabled Adblock Plus for the page and tried to turn off my anti-virus software to allow the download, but it is still empty.

    Download the FULL offline install:Flash Player plugin (all other browsers)

    Close Firefox, and then run.

Maybe you are looking for

  • Cannot add my computer iTunes Match

    I am running iTunes 12.4.1.6 and OS X 10.11.5 on a MBP 13-inch mid 2009 with 8 GB of RAM. I have subscribed to iTunes game and try to add my computer to iTunes game in iTunes. Once I have click on the button 'Add this computer' and type in my Apple I

  • Tecra M9 - upgrade to Windows 7

    Hi all I'm new here so please forgive if I made a mistake. I was given a Toshiba Tecra M9 PMT90E laptop from a friend. I want to upgrade to Windows 7 ultimate 32 bit of Windows Vista Business 32-bit. I downloaded the drivers for the laptop for Window

  • Slow down the AirPlay - Apple TV does not work properly :-(

    Hello. I had a problem of airplay slow play movies, DVD or any video support 720 p or higher on my old one year Apple AirPlay and new Panasonic TV. I've been through problem solving, including restore and optimize my Telus router (which has 2.5 Mbps

  • Advice to upgrade the video card on a6460t

    I have the Intel 2 Quad CPU @ 2.5 GHz, 4 GB of RAM.  I just got Microsoft Flight Simulator software & it tells me I have to update my current video adapter (Intel GMA 3100) to something that is DX10.  I understand that I must keep in mind power, type

  • W500 startup resolution problems

    MDL:4062 - A13, the last Bios V1.19, last 8.52.4.4 Vista Bus32 display drivers At startup, the laptop will be sweeping low resolution for the login and the first Vista boot screen, as boot sequence continues the machine finally set to 1920 x 1200 and