Track last operation on particullar row(identified by primary key)

I have two table 'EMP' and EMP_CLASS ,There is a store procedure which is execute in every ten minutes interval.
Role of procedure is to take back up from emp table only changes affeted to the rows in between that 10 minutes.
But i want something like this suppose there is a row inserted once and updated once within that interval,
I want only last transaction should be taken to consideration by the procedure of same row.
can anyone please tell me how to achive this?

Hi,
1) If you have the right to alter the table emp, you can add a column that flag the new/modified rows:
alter table emp add(flg_modified varchar2(1) default 'Y')
create or replace trigger flag_changed_rows
before update
on emp
referencing new as new old as old
for each row
begin
   :new.flg_modified   := 'Y';
end;
/.. and in your procedure backup only changed/new rows in the emp_class table.
insert into EMP_CLASS(...)   /* All columns exception the flg_modified column */
select (...)  from emp where flg_modified = 'Y';
update emp
set flg_modified = 'N'
where flg_modified = 'Y';
commit;2) if you don't have the right to add a column in the emp table, you can use a merge statement in the backup procedure:
(pseudo code):
merge into emp_class ec using
(select * from emp) e
on(e.pk=ec.pk) /*put an unique id*/
when matched then update set ..
where /* test if the fields are different */
when no matched then insert
/* insert the record here */
... REM: this solution will force you to read the full content of you EMP table . (can be 'problematic' if the table is huge).
3) or use a flahback query and compare the DELTA (but you need to be precautious to define the single point in time between subsequent executions)
Edited by: user11268895 on Aug 16, 2010 11:56 AM
Edited by: user11268895 on Aug 16, 2010 11:57 AM

Similar Messages

  • Automated row fetch / Complex primary key

    I have a complex primary key made up of ticket_num, ticket_seq because there may be between 1-3 rows associated with one ticket_num.
    The problem I am having is the automated row fetch errors out when trying to update a ticket with the following error even though the combination of ticket_num, and ticket_seq are unique, and ticket_num, ticket_seq are entered in the automated row fetch as primary key column, and secondary key column.
    ORA-01422: exact fetch returns more than requested number of rows
    Is there a way to put both columns as the primary key?

    Thanks, Scott. I had the exact same problem, and your suggestion fixed it.
    May I suggest that this is a bug in Apex? In the create application wizard, select "Add Page" -> "Report and Form", and select a table with a compound primary key consisting of two columns. Apex will create the report and the form, and will configure the ARF correctly in the form, but it does not specify a value for the second key in the Link Column section of the report attributes.
    Thanks,
    Mike

  • What is the diffrence between Row id and primary key ?

    dear all
    my question is about creating materialized views parameters (With Rowid and
    With Primary kry)
    my master table contains a primary key
    and i created my materialized view as follow:
    CREATE MATERIALIZED VIEW LV_BULLETIN_MV
    TABLESPACE USERS
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT
    BCODE ID, BTYPE BTYPE_ID,
    BDATE THE_DATE,SYMBOL_CODE STOCK_CODE,
    BHEAD DESC_E, BHEADARB DESC_A,
    BMSG TEXT_E, BMSGARB TEXT_A,
    BURL URL, BTIME THE_TIME
    FROM BULLETIN@egid_sefit;
    I need to know is there a diffrence between using (with row id) and (with primary key) on the performance of the query?

    Hi again,
    fast refreshing complex views based on rowids, according to the previous subject.
    (You're example shows that) are not possible.
    Complex remote (replication) snapshots cannot be based on Rowid too.
    for 10.1
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm#sthref5054
    for 10.2
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6002.htm#sthref6873
    So I guess (didn't check it) that this applies ONLY to replication snapshots.
    This is not documented clearly though (documentation bug ?!)
    Documentation states that the following is generally not possible with Rowid MVIEWS:
    Distinct or aggregate functions
    GROUP BY or CONNECT BY clauses
    Subqueries
    Joins
    Set operations
    Rowid materialized views are not eligible for fast refresh after a master table reorganization until a complete refresh has been performed.
    The main purpose of my statements was to try to give a few tips how to avoid common problems with this complex subject, like for example: being able to CREATE an MVIEW with fast refresh clause does not really guarantee that it will refresh fast in the long run (reorganisation, partition changes) if ROWID based, further the rowid mviews have limitations according to the documentation (no group by, no connect by, link see above) plus fast refresh means only to use filter columnns of the mview logs, plus for aggregates you need additional count (*) pseudo columns.
    kind regards
    Karsten

  • Determining the row id or primary key columns and values genericaly

    Hi There
    Does anyone perhaps know how to determine the rowid of the
    currently selected row in a form, or alternatively the primary
    key values/columns?
    Regards
    Herman

    Hi Tranen,
    you can view the constraints and respective columns by setting the
    Table Shape Properties in the Property Inspector.
    Select (all) the tables on the Diagram you want
    In the Property Inspector,under Constraints -Set the 'Show Constraint Columns' to 'True',
    Set 'Show Constraints' to 'True' .
    Constraints (PK,UK,FK,Check)
    Also Set the 'Show Columns' option to 'False' .This will be under display options in the Property inspector.
    This should modify the Table shape in the diagram as follows:
    <Table name>
    <PK> PKName:Column1,Column2
    <UK>UKName:Column3
    <FK>FKname:Column1
    are you looking for the same?
    Thanks.

  • Need to create a new row in table with same data as Primary key, but new PK

    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kale

    user9970447 wrote:
    Hello Gurus ,
    I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
    Any ideas of how it can be done without much complication?
    Thanks in advance for your reply.
    Reards,
    Swapneel Kalesomething like
    insert into mytable values ('literal for new pk',
                                           select non-pk-1,
                                                    non-pk-2,
                                                    non-pk-n
                                           from mytable
                                           where pk-col = 'literal for existing pk')

  • How to get the last transaction in a row in SQL Developer?

    What syntax would I use to get the last transaction of a row in SQL developer?
    The way I have my query set-up currently it is not returning the correct data, here is my current syntax:
    select ssn, max(tran_id), chng_type,tran_id
    from pda_tran
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type,tran_id;
    It returns a 'C' chng_type but it is not the last one. when I query on this ssn this is what I get:
    ssn tran_id chng_type
    xxx-xxx-0011 001 A
    xxx-xxx-0011 002 E
    xxx-xxx-0011 003 C
    xxx-xxx-0011 004 S
    xxx-xxx-0011 005 C
    xxx-xxx-0011 006 T
    I only want to return the ssn's with a last transaction chng_type of 'C'. How can I get the correct information returned. Please advise.

    From what I see and read... there is one to many group by
    You wrote
    select ssn, max(tran_id), chng_type,tran_id
    from pda_tran
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type,tran_id;
    If you want the max(tran_id), remove it from the "group by"
    select ssn, chng_type, max(tran_id)
    FROM
    (SELECT 'xxx-xxx-0011' ssn, '001' tran_id, 'A' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '002' tran_id, 'E' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '003' tran_id, 'C' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '004' tran_id, 'S' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '005' tran_id, 'C' chng_type FROM DUAL UNION
    SELECT 'xxx-xxx-0011' ssn, '006'tran_id, 'T' chng_type FROM DUAL )
    where ssn = 'xxx-xxx-0011'
    and chng_type = 'C'
    group by ssn, chng_type;

  • Hi all, my mac book pro boots up, but my track pad operation is strange, cannot click on anything, although it moves around screen ok. Cannot launch anything, nor close anything. Cannot get task bar to pop up either with the mouse movement.

    Hi All,
    My mac book pro 13". It boots ok and skype launches on boot up. connects to internet etc. However, whilst the mouse moves around the scren ok, used via the track pad, I cannot open anything, close anything, or get the task bar to pop up.
    I can close the laptop down via the power key, and can use some short cut keys, but the track pad operation is iffy, can you suggest how I rectify this.
    I have now solved this, for future reference, I have a magic track pad as well and that was connected via bluetooth and sitting else where in the house. It blocked the laptops trackpad operations. When disconnected, my laptop track pad works fine.
    Cheers
    Jazzy
    Message was edited by: Method TV

    Hi All,
    My mac book pro 13". It boots ok and skype launches on boot up. connects to internet etc. However, whilst the mouse moves around the scren ok, used via the track pad, I cannot open anything, close anything, or get the task bar to pop up.
    I can close the laptop down via the power key, and can use some short cut keys, but the track pad operation is iffy, can you suggest how I rectify this.
    I have now solved this, for future reference, I have a magic track pad as well and that was connected via bluetooth and sitting else where in the house. It blocked the laptops trackpad operations. When disconnected, my laptop track pad works fine.
    Cheers
    Jazzy
    Message was edited by: Method TV

  • Hello, a cant type anything ,not in photoshop and not in inIllustrator ,I've got a message like "selected font faild during last operation".If problem persists,please desable the font..

    Hello, a cant type anything ,not in photoshop and not in inIllustrator ,I've got a message like "selected font faild during last operation".If problem persists,please desable the font..

    Looks like a corrupt font.
    Illustrator is more picky about fonts than any other application.

  • Check what is the last operation for a table

    Hi expert,
    I need to check what is the last operation for a table ? ( such as insert/delete/truncte.......), will show me the function or sql to get that?
    Many Thanks,

    hi,
    please take a look at this link
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1590655700346557237
    regards,

  • Name of built in unique row identifier field in Oracle

    I believe that I read somewhere that each Oracle database table comes with a built in unique row identifier field. Could somebody please confirm whether this is true and if so, please tell me the name of that field.
    Thanks.

    Are you referring to ROWID by any chance? If yes, this may help with the relevant information - http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/datatype.htm#i8776
    Thanks
    Chandra Pabba

  • Photoshop cc error "selected font failed during last operation"

    I just installed new fonts to Windows 8 PC running CC Suite with Type Kit running. When I open a previously made template in PS I keep getting photoshop cc error "selected font failed during last operation". Type kit does not show the font. The font is installed on my computer.
    - The template has the original version of the font named "Adam". I downloaded the updated version now named "Adam.cg pro".
    - I click on the substitution caution in the layers palette and select the new version of the "Adam" font.
    - When i try to save my changes I get, error "selected font failed during last operation. If problem persists, please disable font."
    Can anyone help me solve/fix this problem?
    Thanks,
    Brett

    I just installed new fonts to Windows 8 PC running CC Suite with Type Kit running. When I open a previously made template in PS I keep getting photoshop cc error "selected font failed during last operation". Type kit does not show the font. The font is installed on my computer.
    - The template has the original version of the font named "Adam". I downloaded the updated version now named "Adam.cg pro".
    - I click on the substitution caution in the layers palette and select the new version of the "Adam" font.
    - When i try to save my changes I get, error "selected font failed during last operation. If problem persists, please disable font."
    Can anyone help me solve/fix this problem?
    Thanks,
    Brett

  • That last operating system is compatible with PowerBook G4? thank you very much

    That last operating system is compatible with PowerBook G4? thank you very much

    As is the previous Operating System.
    Stedman

  • Oblix audit logs to track last login time in Sun DS

    Hi,
    I would like to use oblix audit logs to track last login time in Sun DS.
    Is there a straightforward procedure to do that other than parsing the logs and using custom script to update Sun DS.
    Please advice.
    Thanks.

    Hi,
    In OAM you can define your own plugins to run during the authentication (you include them in the relevant authentication schemes) - you could write one that updates the user profile of the logged-in user. You would be pretty much on your own, though, all that OAM would give you is the DN of the logged in user. You would need to include libraries that connect to ldap (or maybe the plugin could send a web service call) and perform the necessary attribute updates. Authn plugins are documented in the Developer Guide: http://docs.oracle.com/cd/E15217_01/doc.1014/e12491/authnapi.htm#BABDABCG (actually that's for 10.1.4.3).
    Regards,
    Colin

  • ""selected font failed during last operation." and " there is a problem with generator" application error

    For PSDs I have created in older versions of Photoshop CC 2014 I am getting errors when opening / trying to save. They seem to be either Generator or font related. Interestingly, PSDs created in newer versions of PS CC 2014 have no issues, even when using same fonts.
    I am getting the error messages:
    When I open the older PSD files, (again created or saved in older versions of PS CC 2014) I am asked to update fonts. If I do I get the error.
    'Selected font failed during last operation'
    When I try to don't try to update fonts and then I try to play with the file I get the following error.
    'There is a problem with Generator. Please quit Photoshop and try again. If the problem persists, remove any third-party plugins or try re-installing photoshop.
    I don't have any third party plugins that I can see.
    I have re-installed multiple times.
    I need to use this program and I am paying for your services. I am actually on the phone now with 'help desk' and have been on hold for 22 minutes.
    Please Help

    When I installed the Apple programs, mobile device application did not uninstall by itself. I had to go to c://program files/common files/apple/mobile device application (or something like that) and manually delete the contents and the folders. I have a 64 bit version so I also had to visit c://program files (x86)/common files/apple/mobile application device (or similar) and also manually delete the files and folders. I had to delete the files before I could delete the folders. This manual part is probably tripping everyone up, because it's not as easy as simply hitting uninstall in the control panel. But the instructions are there. I hope this helps you.

  • Setting row identifiers in default table model

    hey i'm making a default table model and i cant figure out how to make a row have an identifier. the column one is setColumnIdentifiers but there isn't a code that i could find for a row.. please help thanx kevin

    You are correct, JTable does not support a TableRowModel, therefore it does not support setRowIdentifiers.
    I'm not sure exactly what your requirement is so its hard to make a suggestion. You could add an extra column to your table to contain a row identifier. You could then remove this column from the TableColumnModel to prevent this column from being painted. This [url http://forum.java.sun.com/thread.jsp?forum=31&thread=411506]thread shows how to remove a column from the table.

Maybe you are looking for

  • How to manage linked files with multiple designers?

    Hi, I work at a small company with multiple designers (5 of us) where 3 of us work remotely. We use dropbox to manage our files so that everyone has access--we keep client files in specific folders and stock media in a shared folder. Currently whenev

  • Order by taking too much time. Tried using all_rows hints no use.Pls advice

    I run the query without order by and finishes in less than 30 sec. Once you have order by,query just hangs. Pls advice. Thanks. select col4,col6 from table a , table b, table c where a.col1 = b.col2 and a.col1 = c.col3 order by col1,col2 desc

  • Is there a way to add jar file in my program

    sorry to botter you, but i really need help for this, i really dont know how to do it. i have my prog taht i want to put in jar file, that cause no problem, but my program isnt fully functionnal because he use a jar file (my driver to acces my databa

  • How long does the pre approval process take?

    I found a local lender with no overlays for an fha loan! He sent everything to AU. How long should it take to hear back? He couldn't give me a loan amount off the bat and now I'm anxious lol

  • Very small Wobble screen

    Hi i have peoblem with my iphone 5c screen can you help me? My display in middle of the right side if pushed is unclench and make sound Recently realized this and due to the high activity of this problem, but the performance does not matter This issu