How do i find difference of data between 2 tables & insert a flag based on

I got a situation like.
My application is connecting to different database and getting data to our schema
using dblink.That data is stored into a temporary table.Every day a nightly job is executed and stores the latest data into temp table .we compare the data in temp table with master table.If it is new record insert into master,if the record does not exists delete it,if the record is modified update.
This is taking too long in production.
My idea is
First iam getting all data into temp table.temp table data is compared with master and getting only modified data(mismatch)into another temp table.i want to insert a flag like I for insert,d for delete and u fro update to this temp while comparing only.
please give some tips to resolve this issue.
or give me the best solution to improve its performance.
Thanks in advance
Looking forwrd to hear an immediate response

How do you compare two records? Is it by comparing only PK or UK fields or all the fields? The solution comparing PK's or UK's
TEMP_TBL table - tid is the PK
MASTER table - mid is the PK
update TEMP_TBL set flag='N';
update(select a.flag from TEMP_TBL a, MASTER b where a.tid=b.mid)
set a.flag='Y';
update(select a.flag from TEMP_TBL a, MASTER b where a.tid=b.mid(+) and a.flag='N') set a.flag='I';
-- Compare fields other than PK.
-- Update flag
update(select a.flag from TEMP_TBL a, MASTER b where a.tid=b.mid(+) and a.flag='N' and a.col1<>b.col1) set a.flag='U';

Similar Messages

  • How to find difference in amount between two fields in two different tables

    Hi,
    I am new to PL/SQL. I need to write a procedure to calculate the difference between two columns of two seperate tables. For example:
    I have Table a and Table b. Both with two columns Id and Amount. I need to find the difference of Amount between table a and table b value for each record in table b, store it in variable and then do further operations using that difference. Kindly help me with this.

    Something like this?
    INSERT INTO table_c (id, diff, p_or_n)
    SELECT
    a.a_id,
    a.a_value - b.b_value
    DECODE( SIGN(a.a_value - b.b_value),
      1 , 'P',
      0 , 'P',
      -1, 'N'
    FROM table_a a JOIN table_b b
    ON (a.a_id = b.b_id);
    -- Ranit

  • How can I find out the date of a movie I am trying to pre-order if the date is not available/showing in the "manage pre-order" section?

    How can I find out the date of a movie I am trying to pre-order if the date is not available/showing in the "manage pre-order" section?

    Thanks so much for your reply King_Penguin. No, sadly there is not indication of the expected release date on the film, it's no where to be found. I have also tried to look in other places online, but no luck. I guess your latter statement jives more with my situation, that  being the studio/rights-holder hasn't feel inclined to provide the date.

  • How do I find out the date in which I registered my imac?

    How do I find out the date in which I registered my imac?

    It doens't really matter what date you registered it. However if you are looking to see when your expiration on AppleCare is/was it is 3 years from the original date of purchase. You can use the Apple Online Service Assistant afer you input the serial number click the link that says See your service and support coverage.

  • How do I find my iCloud data that Yosemite erased ?? Yosemite has resurrected an old Apple ID from the Me days. Everything is gone because of Yosemite

    How do I find all my data on ICloud. I downloaded Yosemite and it erased ALL of my data on the Cloud. It caused an Apple ID from Me to resurrect and has wreaked havoc on my devices. It even erased all my backup data on my Passport drive. The Passport drive shows all of my downloaded backups from 2011, but when you double clickon the various backup dates, they all show as empty. I was able to restore my music by downloading a 3rd party application, but my pictures are gone. I was having a conversation thisweekend and an eavesdropper said she has the EXACT same problem.

    An apple ID is nothing more than a "User ID"
    Actually, it is more than that. If you read the licensing agreements for any OS version or app obtained at the app store, it will become clear: the license for any app or OS obtained at the app store is not transferable. Hence it is tied to your Apple ID and will remain so - it cannot be removed.
    You are supposed to remove anything obtained at the app store from the computer before giving/selling it. Your father will also not be able to reinstall the OS if need be.
    Which OS version was on the Mac originally? You will need to use internet recovery (Command + Option + R) to erase your drive and then reinstall the original OS (if Lion or later). If it came with an install DVD, boot from that, erase the drive and reinstall. After that, your father can very easily download/update/reinstall any OS or app using his own Apple ID.

  • How can I exchange my whole data between my mac book pro and my iMac?

    How can I exchange my whole data between my mac book pro and my iMac?

    i use both, the macbook at work and the imac at home, but ineed to have the same data on both macs, how can i sync them?

  • How to make the exchange of data between 2 while loop in real time

    hello
    I have 2 while loop
    the 1st while loop includes the data acquisition program
    the 2nd while loop includes the control program
    my question is how to make the exchange of data between 2 while loop in real time
    I tried with the local variable and direct wiring between the 2 while loop
    it does not work (there is a delay)
    Solved!
    Go to Solution.

    Bilalus,
    Queues are only good to transfer data if your application isn't deterministic. Since you are using Real Time, I am assuming that your application requires determinism. If you are using Timed Loops and you use queues to transfer data between your loops, you are losing determinism. In this case, you need to use the RT FIFO functions. 
    Warm Regards,
    William Fernandez
    Applications Engineering
    National Instruments

  • How can I get extract the data between two cursors on an XY graph

    How can I get extract the data between two cursors on an XY graph

    Well, you say xy graph, so this might be a more complicated problem.
    For a waveform graph it's trivial. Simply get the two cursor indices (property: cursor index) and apply them to array subset of the data. Is that all you need?
    Here's how the above code would look like. using cursor.index instead of cursor.x elimnates the need to include scaling information.
    For an xy graph, there could be multiple segments (e.g. imagine a spiral that passes the desired x range multiple times from both sides). This would neeed significantly more code for a general solution.
    Message Edited by altenbach on 11-24-2009 07:53 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    cursorsubset.png ‏17 KB

  • How to find the deleted data in tables

    guys,
    how to find the deleted data in tables example: i want to see whether anyone deleted data in MB5B report tables like mbew, etc.,
    regards,

    Hi,
    MBEWH is actually the history table of MBEW. It will record all the changes. As I have told you earlier if you have deleted the record dirctly from the table then it will not come even in the table MBEWH
    That means no changes have been made.
    regards

  • How do I find out the date and time a picture was taken on my Ipad?

    How do I find out the date and time a picture was taken on my Ipad?

    Photo Manager Pro
    http://i1224.photobucket.com/albums/ee374/Diavonex/Album%202/7a2b3650710f4bded81 ab75dda6a3ee5.jpg

  • How can we find out that the Z table is adjusted or not???

    Dear Friends,
    How can we find out that the Z table is adjusted or not???
    I have activated it but I need to se that the table is adjusted or not? I know we can do it from SE14 but I don't have an authorization ,
    Thnaks,
    Sridhar

    Hi, Thanks for the reply,
    As per ur suggestion of path direction I have checked the table in production and development both.
    In my Z table, I have 2 key fields and for those 2 key fields the primary indexs are created automaticaly and displayed in Developement but in Production there is no indexs are created for those 2 fields.
    Could you please guide me what could be the reason?
    Thanks in advance.
    Regards
    Sridhar

  • How Many  NUMBER Fields Can SINGLE DATA BASE TABLE CONTAIN

    How Many  NUMBER Fields Can SINGLE DATA BASE TABLE CONTAIN

    Hi
    One Database table contain 249 Fields.
    Rewards Points if useful..
    Regards
    Nikunj Shah
    Edited by: Nikunj Shah on May 13, 2008 1:08 PM

  • How to find difference of files between 2 checkpoints in a virtual machine

    hi ,
    i had 2 checkpoint . certain fucntionality works in one and  not  in other checkpoint .
    Same files are copied to 2 checkpoints . 
    IIS webserver /.net framework i guess might be corrupted . how do we find the difference in files between 2 checkpoints .

    Checkpoints are binary differences between two states of the VM thus there's no concept of change as it relates to file level or configuration level changes to track and I can't imagine really trying to find a difference between the two in this way.
    If this relates to creating a base/reference OS image, it's just another reason to use a build and caputre task sequence so that you always have a freshly built and clean image that is easily recreated.
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • Moving data between tables (how to find out if the 2nd table is empty)

    Hi,
    I have 2 tables, and I'm copying records from one table to another.
    I've followed the Wiki: [https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/movingdatabetween+tables]
    So far, everything works ok.
    Here is my question: how do I get the number of records passed?
    I mean, how do I know the number of rows in the 2nd table? (Remember that this number is variable, because it depends on how many rows I've inserted and deleted on the 2nd table).
    I've tried to achieve that using a data store with a numeric field, but I couldn't find the way to increment/decrement the numeric field on data store, and insert/delete the row on table at the same time .
    All I want is to find out if the 2nd table is empty or not.
    Any ideas to solve this?
    Thanks in advance!
    Help will be point-rewarded.
    Marcelo

    Hi Ahmed
    thanks for your reply, it was very helpful!! (I've assigned points to you)
    However the user can add twice or more times the same row... so the counter doesn't reflect the real number of rows in the 2nd table.
    I've partially solved this also using a data store with a parameter called key_list, where I add (I mean, concatenate) the key field for the selected row.
    So, if I have a table with 4 rows with key fields "key1", "key2", "key3", the parameter key_list would get "key1;key2;key3".
    So far, it's ok. But when I remove a row previosly added.... I can't remove the key from the key_list parameter. (I mean, from 2nd table I choose to remove the "key2" row, but I don't know how also remove the key name from the key_list)
    I hope be clearly enough.
    Any help will be really appreciated and point-rewarded.
    Thanks again.
    Best Regards
    PS: is there any way of "mark" a row that has been added to the 2nd table? I mean, using (for example) a hidden boolean field named "added", that becomes true when the selected row is added to the 2nd table.

  • How can I find out my data usage for the past 3 months?

    Greetings all, I have been a long time Verizon customer, and as such I, along with my husband, was grandfathered into the unlimited data plan. When I last spoke to a representative, they informed me that the only way we were going to be able to keep our unlimited data was by paying the full retail price ($600+) to get a new phone. So we were considering upgrading and changing to one of the newer data plans so we could still get the discounted price on the new phone, but I would like to make sure I choose one with enough data, without paying for a bunch of data that I don't use, however MyVerizon only shows me the amount I have used since the start of the billing cycle. Is there a way to find out the data usage for both my husband and myself for the last 3 months so I can choose the right option?
    Thanks in advance for your help!

        Hello sweetpea1221! How exciting that you're considering upgrading with us. mrhelper is helpful, indeed. You can view your data usage for each line under the View Bill option via your My Verizon account. You can also view your 3 month average  data usage with our Account Analysis feature. Here's a link that will be helpful in doing so http://bit.ly/vnLjqO. I'm confident that we have a great plan to match your data needs. Please let us know if you have further questions.
    TanishaS1_VZW
    Follow us on Twitter @VZWSupport

Maybe you are looking for

  • How to back up contacts in E61i since using window...

    Hi everyone. i am from Malaysia and I use a Nokia E61i. Once a month I will sync my mobile with my pc and the contacts are automatically updated in Outlook. I then export the updated contacts into Excel and other (tab, csv) formats for safekeeping. N

  • Envy 700 w/Windows 8.1 Boots Past Advanced Start-Up Options Menu

    I have an Envy 700 desktop with Windows 8.1.  I'm trying to install a non-signed driver. I've gone through the documented process that is supposed to bring up the Advanced Startup Options screen, however when I do the Re-start it boots right past it

  • ABAP functions for BI Queries

    Hi Experts, We are trying to obtain a csv file from the data result of a query in a report. Like the option: rsrt, query visualization HTML, export to csv. Is there any abap function we can use to achieve it ? Our SAP BI version is 3.X, so it's bette

  • JSP argument mapping

    Hi, I am new to JSP and was trying my hands at using JSP in BPM.I was able to build a simple JSP where the user enetered the name and his age which I had retrieved in BPM by using BPM tag library.The form also has two buttons Submit and Cancel button

  • Show ebook cover page instead of default EPUB icon

    Hi, As my collection of PDF ebooks was growing, I grew to appreciate the fact that Acrobat was showing the ebook cover in Windows Explorer instead of the default icon. It allowed me to quickly search for ebooks by browsing through the covers quickly,