Delta Calculation and Updating multiple tables

We pull data from a System of Records table that contains the most up to date information. The information changes daily so we have a delta process to identify what new records were added, which records were deleted (records that are not found in the table as compared to yesterday) and which were updated. Delta process compares the already loaded data with the newly updated SOR data to find the differences.
Once the delta is established, either new records get added or existing records get updated or existing records are marked as inactive (Deletes). Additions and Updates generally happen across multiple destination tables.
Updates are identified by looking at different columns to see if any one column is changed. These columns end up in different tables.
Example
Source Delta Table, S1
ID COL1 COL2 COL3 ACTION
1 abc xyz pqr A
2 bcd lmn def U
S1.Col1 maps to Destination Table D1.Col23
S1.Col2 maps to Destination Table D2.Col45
S1.Col3 maps to Destination Table D3.Col11
Currently all tables are updated irrespective of whether the relevant data has changed or not (All 3 destination tables are updated).
I would like to know which of the Columns for a given row has changed values so that I can update only the relevant tables.
Thus if additional columns are available that act as flags
Source Delta Table, S1
ID COL1 COL2 COL3 ACTION COL1 COL2 COL3
1 abc xyz pqr A - - -
2 bcd lmn def U N Y N
3 kjh qwe iop U Y Y N
then for incoming ID=2, I just have to update Destination Table D2 and not D1 and D3
for incoming ID= 3, I have to update Destination Tables D1 and D2 but not D3.
How can I achieve that?
This is mainly to improve performance as the processing time is very short - Faster the delta processing, better will it be.
Thanks in advance.

Thanks for your response.
My question was more towards establishing what has changed.
Given a table, which is updated daily, how does one efficiently establish which data has changed?
Here is an example to clarify my question further
The Source table has the following data on a particular day
Data in Source table on Monday               
ID     Col1     Col2     Col3
1     abc     bcd     cde
2     def     efg     fgh
3     ghi     hij     ijk
4     jkl     klm     lmn
Copy of the above data is stored in a Old Data table
Data in Source table on Tuesday               
ID     Col1     Col2     Col3
1     bac     bcd     cde
2     def     gfe     fgh
3     ghi     jih     jik
5     mno     nop     opq
Data in Source Table is compared with data in Old Data Table
Delta established by comparing Source Table with Old Data Table                    
ID     Col1     Col2     Col3     Delta_Flag
1     bac     bcd     cde     U
2     def     gfe     fgh     U
4                    D
5     mno     nop     opq     A
Rows with IDs 1 & 2 were updated - thus to be updated
Row with ID 3 - no change so not seen in delta
Row with ID 4 was not found - thus to be deleted
Row with ID 5 was new - To be added
I can do the above easily. I would like to a step further to be able to say for updates
Row with ID 1 has Col1 changed
Row with ID 2 has Col2 and Col3 changed
Is there an easy way to do this?

Similar Messages

  • Updating multiple tables using JDBC Adapter

    Hi,
    I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
    Thanks in advance!
    Hart
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
    <DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>

    Hi,
    You need 2 STATEMENT level tags,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
    <b><DeliveryData1></b>
    <DelHeader action="UPDATE_INSERT">
    <table>DelHeader</table>
    <access>
    <DelNo>0080000230</DelNo>
    <DelType>LF</DelType>
    <XOverwrite>X</XOverwrite>
    <ShipTo>0000000026</ShipTo>
    <SoldTo>0000000026</SoldTo>
    <Priority>00</Priority>
    <DocDate>02/17/2007</DocDate>
    <GText>CIF est</GText>
    <DelDate>02/20/2007</DelDate>
    <PickDate>02/20/2007</PickDate>
    <ShipPoint>NO02</ShipPoint>
    <PackCount>00000</PackCount>
    </access>
    <key>
    <DelNo>0080000230</DelNo>
    </key>
    </DelHeader>
    <b><DeliveryData1></b>
    <b><DeliveryData2></b>
    <DelItem action="INSERT">
    <table>DelItem</table>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000010</ItemNo>
    <GText>10# GRAN-GREAT VALUE</GText>
    <Material>G04410G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BL</UOM>
    </access>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000020</ItemNo>
    <GText>25# GRAN- GREAT VALUE</GText>
    <Material>G04025G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BG</UOM>
    </access>
    </DelItem>
    <b></DeliveryData2></b>
    </ns0:DeliveryDBUpdate>
    Try with such a strcuture and let us know if it works.
    Regards
    Bhavesh

  • Updating Multiple Tables

    Hi All, Is there any way to update multiple tables in a single query. I know we can write triggers. Apart from triggers, is there any other way available in SQL Server. I am using 2008R2.

    As alternative you can write something like that 
    BEGIN TRANSACTION
    BEGIN TRY
    Update
    Update 
    Update
    COMMIT
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT> 0 ROLLBACK
    END CATCH;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Resource configuration for updating multiple tables

    Hi all,
    My aim is to update multiple tables in Sun Identity Manager
    I would like to know what is the resource to be configured for this
    Could any one help me in solving this issue
    Thanks in advance,
    Shalini

    I have used the Scripted JBDC resource as follows;
    go to Resources > Configure Types and select Scripted JDBC > Save
    at Resources, select resource Type Actions > New Resource
    select Scripted JDBC from the drop down, this should start the wizard
    the wizard will guide you with lots of questions.
    The one problem we had is in the Action Scripts (second wizard page). we found the example scripts
    at the webserver root /idm/sample/ScriptedJdbc/SimpleTable/beanshell
    the above scripts had to be modified to the SQL required for the application, but it worked well with the example databases and codes that it is easily understood.
    there are several examples of different table types here... there are lots of options, see the README iles for each type
    hope this helps;
    TG

  • Analysing and Updating a table

    Hi,
    Can anyone help me on follwing query..
    Can analyse of a table and updation on to same table can happen paralley?
    thank in advance.

    What's your db version? The very first thing is that you should not use the analyze command but dbms_stats package. Now , I am not sure why you want to gather the stats and update the table at the same time? As mentioned by Erica, the update should be followed with the stats gathering. And about the index usage, there are couple of things that can stop index from being used, for example, low selectivity on the column can very well stop the index. Other than that, if you are accessing the column containing the index alone and the column is supposed to contain the null values, oracle would rather use a FTS than using the index which actually makes perfect sense since use of index would result in incorrect data. So there can be couple of htings possible which may stop your index from being used. All what dbms_stats(and even Analyze) command would do , is to make the distribution of the data known tooracle. Having stats alone doesn't guarantee that the index would be used for sure.
    HTH
    Aman....

  • How to call a idoc in abap program and updates catsdb table

    how to call a idoc in abap program and updates catsdb table
    thank you,
    Jagrut BharatKumar Shukla

    Hi Kishan,
    You can refer to following help document,
    http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/content.htm
    Regards,
    Meera

  • Check two columns and update other table

    HI ,
    I have a table called trackCenterline .Below is the table.
    What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id in other table called TrackSegment which is below.  and pick the BeginMilepost of that segmentID and Update That
    Milepost in a new table .At end SegmentSequenceID number it should pick ENDMilepost and update
    TrackCenterline table.
    TrackSegment table
    In the below table for 10001 SegmentID it should pick BeginMilepost. For end Number of SegmentSequenceID in above table ID ends at 121 for that end sequenceID It should refer TrackSegment table below and pick EndMilepost and should be updated in another
    table Milepost column.
    after that a new segment starts with new sequence .and so on ...
    bhavana

    Hi Deepa_Deepu,
    According to your description, since the issue regards T-SQL. I will help you move the question in the T-SQL forums at
    http://social.technet.microsoft.com/Forums/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
    When you want to check two columns from two tables then return some results and update the third table. I recommend you use join function and combine two tables, then use update select from statement for modifying the Mailpost table. You can refer to the
    following T-SQL Statement.
    -----using join to connect to two tables
    select TrackCenterline.FeatureId,TrackCenterline.SegmentId,
    TrackCenterline.SegmentSequenceId,TrackSegment.BeginMilepost,TrackSegment.EndMilepost
    from dbo.TrackCenterline join dbo.TrackSegment
    on TrackCenterline.SegmentId=TrackSegment.SegmentId
    order by TrackCenterline.SegmentId, TrackCenterline.SegmentSequenceId
    ---the result shows as following.
    FeatureId SegmentId SegmentSequenceId BeginMilepost EndMilepost
    AMK100011 10001 1 61.0000 61.3740
    AMK100012 10001 2 61.0000 61.3740
    AMK100013 10001 3 61.0000 61.3740
    AMK1000121 10001 121 61.0000 61.3740
    AMK100021 10002 1 61.1260 61.7240
    AMK100023 10002 3 61.1260 61.7240
    AMK100033 10003 3 61.3740 62.9530
    -----Then you can use update select from statement to modify the Mailpost table, Or you can post the table structure of Mailpost
    And for more information, you can review the following article about update statement.
    http://www.techonthenet.com/sql/update.php
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Updating multiple tables from updatable report

    Hi, I'm new to APEX and SQL and need some help
    I've got 2 tables, one for person (containing employee_id which is the primary key and position_id, which shows the position that the employee fills, and some others) and one for position (containing position_id as primary key and current_inc, which shows which employee is currently in that position, and various others). All variables are varchar2.
    Now I've made an updatable report for the person table that can add and update the table without problems using a multi row update, but I also want if to update the value of current_inc in the position table if I were to assign a position to a certain employee in the person table.
    I've though of using either a trigger or a procedure to do it but havn't been able to find satisfying examples online.
    Any suggestions on how to do it (please include sql code)
    Thanks
    V

    Instead of trigger on view... Create a view with the tables you want updated, then build and instead of trigger on the view to handle the updates between tables See this blog entry for an example: http://dgielis.blogspot.com/2006/09/updateable-view.html
    Thank you,
    Tony Miller
    Webster, TX

  • Edit and update multiple records in JSP buisness components

    Hi everybody,
    I'm building BC4J components using entities and views and JSP buisness components.
    how can I edit and update multiple records
    at a time in the jsp file
    Note using the databean
    "oracle.jbo.html.databeans.EditCurrentRecord"
    one can view one record at a time
    thank you

    do you have a sample code? thanks
    Hi
    There are several options. One of them could be
    1) use <input name=rc[j] value="..."> instead of
    display a raw text
    2) parse parameters in doPost method of your servlet
    to update appropriate values.
    3) Make a empty row enable inserts
    Regards
    Jan

  • Comparing Two tables with 300k records and update one table

    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results  will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
    Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
    Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
    Column B has same data in both the tables.
    I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
    I m trying to do using PLSQL Tables.
    Any suggestion?
    Thanks.
    Why are you trying to use PL/SQL tables?  If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
    Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL.

  • Query and update a table/view

    What is the best & fastest way to do this?
    1) Put up a query input region for users to enter parameters.
    2) Run a query on a table/view using those parameters.
    3) Allow the output in (2) to be modified by user (multiple rows at a time) and then Submit the updates back to update th table/view
    I can do (1) and (2) easily. How can I do (3)?
    Thanks

    Make a report on the table. Go to the definition of
    the report column and change the "Display As" type to
    text field or select list or whcih ever is
    applicable. Write a process on submit to insert these
    values back to the table. You will have control over
    which columns the user can modify.Thats a good idea and I was able to start on it. But how can my after submit process tell which rows to modify? i.e. what will my after submit process look like?
    for rec in (....)
    loop
    update my_table set
    end loop;
    Help? Thanks

  • How to update multiple tables using results from query

    I'm a bit rusty on this stuff and am hoping for some help.
    Table 1 is:
    location_id, location_name
    Table 2 is
    location_id, employee_id and misc. other columns
    Then there are multiple tables with associated data, keys being location_id and employee_id.
    There are no established relationships.
    Trying to come up with a process to change location_id for all employees assigned to a particular location.
    It seems to me that the basics are
    select employee_id from Table2 where location_id='xxxxxx'
    Then take each employee_id returned and change their location_id in each of the other tables
    I'm not clear on how to load the returned employee id's as variables and then loop through them.
    Thanks

    Thanks for the welcome. I'll read up on the rules now.
    Below is the DDL for a couple of the tables.
    Version = 11g
    I would query the users table for all users with a certain site_id and then use them to update the site_id in the users table (and other tables)
    -- DDL for Table USERS
    CREATE TABLE "USERS"
    (     "USERID" VARCHAR2(8 BYTE),
         "PASSWORD" VARCHAR2(50 BYTE),
         "FIRST_NAME" VARCHAR2(50 BYTE),
         "LAST_NAME" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "ROLE_ID" VARCHAR2(1 BYTE)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;
    -- DDL for Table EMPLOYEE_PROFILE
    CREATE TABLE "EMPLOYEE_PROFILE"
    (     "EMPLOYEEID" VARCHAR2(9 BYTE),
         "PROGRAM" NUMBER,
         "REQUIREMENT" NUMBER,
         "JOBNUM" VARCHAR2(50 BYTE),
         "STATUS" VARCHAR2(50 BYTE),
         "PROGRAM_TYPE" VARCHAR2(50 BYTE),
         "SITE_ID" VARCHAR2(5 BYTE),
         "NUM_QUAL_TEST_ATTEMPTS" NUMBER(7,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "SITES_DATA_TS"
    CACHE ;

  • ABAP Client proxies: extract data from the response and update Z table

    Hi All,
    I have following ABAP code for client proxies:
    We have DT_Req, MT_Req, DT_Res, MT_Res and MI_Sync_OB (O/p Message: MT_Req, I/P message:MT_Res)
    Proxy Objects generated:
    ZCO_MI_SYNC_OB
    ZMT_REQ
    ZDT_REQ
    ZDT_REQ_RECORDS
    ZDT_REQ_RECORDS_TAB
    ZMT_RES
    ZDT_RES
    ZDT_RES_RECORDS
    ZDT_RES_RECORDS_TAB
    ABAP Code:
    REPORT ZTEST_DELETE.
    DATA:
    lo_history TYPE REF TO ZCO_MI_SYNC_OB,
    lo_sys_exception TYPE REF TO cx_ai_system_fault,
    Structures to set and get message content
    lv_history_req_mt TYPE ZMT_REQ OCCURS 0 WITH HEADER LINE,
    lv_history_res_mt TYPE ZMT_RES,
    lv_history_req_rec TYPE ZDT_REQ_RECORDS,
    lv_history_res_rec TYPE ZDT_RES_RECORDS.
    lv_history_req_rec-VLAUE = SY-DATUM.
    APPEND lv_history_req_rec TO lv_history_req_mt-MT_REQ-RECORDS.
    CREATE OBJECT lo_history.
    TRY.
    Call outbound Proxy
    CALL METHOD lo_history->execute_synchronous
    EXPORTING
    output = lv_history_req_mt
    IMPORTING
    <b>input = lv_history_res_mt.</b>
    Error handling
    CATCH cx_ai_system_fault INTO lo_sys_exception.
    SKIP 2.
    WRITE:/ lo_sys_exception->errortext.
    RETURN.
    ENDTRY.
    <b>Now I have my response data in the internable "lv_history_res_mt-MT_REQ-RECORDS" which is deep structure.
    How do I extract data records (multiple) from the above internal table and update to Z table??</b>
    Thanx
    Navin

    Hi Navin,
    go to SPROXY, flag structure and search for your table definition. You will find a table definition a field "line" or something, where you find the right structure. Create a new structure with DATA: myStructure type tableStructure. Define a second structure type with your Ztable. Next Loop at internal table into the structure. Inside that loop fill the Zstructure. Insert the Zstrucure (Press F1 on insert to have the syntax you need)
    loop at internalTable into intStructure.
    zstructure-myField = intStructure-myField.
    INSERT ztable FROM zstructure.
    endloop.
    Regards,
    Udo

  • Trigger and Update Flag Table

    I've recently started trying to automate around a dozen procedures. These procedures are set to run immediately after the necessary previous procedure(s) is(are) done.
    What I am attempting to accomplish is a single generic trigger that will fire off each procedure when its parent procedures have finished firing. This will be accompanied by an update_flag table with three columns
    PARENT_PRC----------------------CHILD_PRC----------------------FLAG
    parent_prc_name1--------------child_prc_name1-----------------N
    parent_prc_name1--------------child_prc_name2-----------------N
    parent_prc_name3--------------child_prc_name3-----------------Y
    Logic:
    *1.*     When a procedure fires it updates this table to set any rows in which it is the “PARENT_PRC” by updating the FLAG column to = Y.
    *2.*     The trigger will execute a child procedure if its flag (or in the case of multiple parent procedures; all of its flags) are set to 'Y'. This trigger is set to fire AFTER a table update on the UPDATE_FLAG table.
    ----a.     I have to execute the procedure UFLAG in a job because I want the trigger to execute the procedure and then continue running immediately, rather than wait for the procedure to finish then commit. This way the trigger could start several procedures all running at the same time.
    ----b.     I have made it an autonomous transaction because I needed the job to fire immediately rather than be queued, which required a commit within the trigger.
    *3.*     The last step is to set the flag in UPDATE_FLAGS back to 'N' for CHILD_PRC = '||uflag||' once the child procedure is complete.
    ----a.     I have tried placing the update child_prc = 'N' in the trigger but it won’t allow a trigger that fires on update to update the same table.
    ----b.     I want to avoid putting the update statement in all of my procedures because I would like the option of running these procedures manually for testing purposes WITHOUT effecting the update_flags table.
    Number 3. is the key problem I have been having. Placing code within the trigger to update the update_flags table setting 'Y's back to 'N's once the procedures have fired causes a deadlock error.
    I believe this is simply because the trigger is attempting to update a table which (upon updating) causes the same trigger to fire before it has finish executing.
    How can I update the Flag table to reset the update flags back to 'N'?
    Is there a different way of doing this all together?
    Here is some code with dummy procedures that demonstrates what I have so far.
    With this code, executing parent procedures should set the update_flag table to 'Y' for FLAG where procedure = 'parent_prc'.
    I need to find a way to execute the child procedures AND set the FLAG column back to 'N' from the trigger.
    ex. executing parent_1 should set update_flags.flag = 'Y' where parent_prc = 'parent_1' and thus execute procedure CHILD_A and CHILD_B.
    create table update_flags (parent_prc varchar2(10), child_prc varchar2(10), flag varchar2(1));
    insert into update_flags values('parent_1', 'child_a', 'N');
    insert into update_flags values('parent_1', 'child_b', 'N');
    insert into update_flags values('parent_2', 'child_c', 'N');
    insert into update_flags values('parent_3', 'child_c', 'N');
    insert into update_flags values('parent_4', 'child_d', 'N');
    CREATE OR REPLACE procedure parent_1 as
    BEGIN
    update update_flags set flag = 'Y' where parent_prc = 'parent_1';
    END parent_1;
    CREATE OR REPLACE procedure parent_2 as
    BEGIN
    update update_flags set flag = 'Y' where parent_prc = 'parent_2';
    END parent_2;
    CREATE OR REPLACE procedure parent_3 as
    BEGIN
    update update_flags set flag = 'Y' where parent_prc = 'parent_3';
    END parent_3;
    CREATE OR REPLACE procedure parent_4 as
    BEGIN
    update update_flags set flag = 'Y' where parent_prc = 'parent_4';
    END parent_4;
    CREATE OR REPLACE procedure child_a as
    BEGIN
    dbms_output.PUT_LINE('CHILD_A Worked');
    commit;
    END child_a;
    CREATE OR REPLACE procedure child_b as
    BEGIN
    dbms_output.PUT_LINE('CHILD_B Worked');
    commit;
    END child_b;
    CREATE OR REPLACE procedure child_c as
    BEGIN
    dbms_output.PUT_LINE('CHILD_C Worked');
    commit;
    END child_c;
    CREATE OR REPLACE procedure child_d as
    BEGIN
    dbms_output.PUT_LINE('CHILD_D Worked');
    commit;
    END child_d;
    CREATE OR REPLACE TRIGGER MASTER_TRG
    AFTER UPDATE
    ON UPDATE_FLAGS
    DECLARE
    Pragma  AUTONOMOUS_TRANSACTION;
    BEGIN
      DECLARE
      job_num number;
      uflag varchar2(1000);
      BEGIN
            select  MAX(case when COUNT(case when flag='Y' then 1 end)=COUNT(*) then CHILD_PRC else '  ' end)
            into uflag
            from        update_flags
            group by    child_prc;
            IF   uflag <> '  ' THEN
                                      --update update_flags set  flag = 'N' where child_prc = uflag     --(line of code that causes deadlock error)
                            dbms_job.submit (job => job_num,
                            what => ' '||uflag||';'
            END IF; 
       END;            
    COMMIT;
    END MASTER_TRG;
    execute parent_2;
    execute parent_3;

    >
    I think I am getting my head around the transactional/trigger issue.
    >
    It doesn't sound like it since you are still talking 'triggers'. At any rate it is OP that needs to get their head around it.
    OP doesn't even know what the entire process needs to be but has already decided that
    1. a single generic trigger that will fire off each procedure when its parent procedures have finished firing
    2. an update_flag table with three columns: PARENT_PRC, CHILD_PRC, FLAG
    3. a procedure fires it updates this table to set any rows in which it is the “PARENT_PRC” by updating the FLAG column to = Y.
    4. a job - I have to execute the procedure UFLAG in a job
    5. I have made it an autonomous transaction because I needed the job to fire immediately rather than be queued, which required a commit within the trigger.
    6. there should be an option of running these procedures manually for testing purposes WITHOUT effecting the update_flags table.
    Fortunately OP had the wisdom to ask
    >
    Is there a different way of doing this all together?
    >
    Doesn't anyone design things anymore? Seems like everyone just wants to decide what the solution ought to be be and then try to force the problem to fit into it.
    The first stage is the DESIGN - not the implementation details or technology to use.
    The first design step is to outline, or flowchart, the PROCESS that needs to take place. Since OPs post lacks sufficient detail I will substitute my own 'guesstimations' to illustrate.
    1. there are one or more 'parent' processes
    2a. these parent processes are allowed to run in parallel as they do not interfere in any way with the processing done by other parent or child processes. (is this true?)
    2b. these parent processes ARE NOT allowed to run in parallel as they may interfere with each other.
    3. Each parent process can have one or more 'child' processes. (it appears that these aren't really children but rather processes that are 'dependent' on the parent or that must always be executed after, and each time that the parent executes.
    So here are just SOME of the things that are missing that must be known before possible alternatives can be explored
    1. Re item #2 - can the parent processes be executed in parallel? Or must they be executed serially? Will any of the parent processes be dependent on any other parent or child process?
    2. What is the relationship between a parent process and its child processes? Is the parent always executed first? What triggers the parent execution? How often is it executed?
    What if it is already executing? What if other parent processes are currently executing? What if one or more of its child processes are executing? What if the parent process fails for any reason - what action should be taken?
    Based on what was posted a set of parent and child processes might need nothing more than: execute parent, execute child1, execute child2, . . ., execute childn.
    3. What is the relationship between the child processes that belong to the same parent? Can they be executed in parallel (i.e. are they completely independent)? Or must they be executed in some particular order? What if one or more of the child processes fails for any reason - what action should be taken?
    4. Will any other user or process be executing these parent or child processes? That could interfered with the automated stream.
    5. What type of exception handling and recovery needs to be implemented in one or more steps of the processing fail for some reason?
    Typically there is often one or more control tables (OPs flag table) to control and limit the processing. But the table would have status information for every process not just the children:
    A. STATUS - DISABLED, ACTIVE, RUNNING, IDLE, ERROR
    B. START_TIME
    C. END_TIME
    D. RESULT_CODE
    The control table can be used by a parent or child process to determine if it is permitted to run. For example the first thing a procedure might do is check it's own STATUS. If it is already running it would exit or log an error or message. If that test is passed it might check the status of any dependent processes. For example it might check that its child processes are ACTIVE and ready to run; if a child was still running the parent would exit or log an error or message.
    The control process would lock the appropriate control table records (FOR UPDATE) and would set the status and other fields appropriately to prevent interference by other processes or procedures.
    Design first. Then look at the implementation options.

  • Listening to change in a row of a table a and update a table in a diferent Database

    i want to update a table using values from a different database table. how to i do it in SQl 2012

    i want to update a table using values from a different database table. how to i do it in SQl 2012
    With Service Broker?
    Without Service Broker, you would do:
    UPDATE targettbl
    SET    col1 = b.col1,
           col2 = b.col2,
    FROM   targettbl a
    JOIN   srctbl b ON a.keycol1 = b.keycol1
                   AND a.keycol2 = b.keycol2
    It is important that a row in targettbl maps to at most at one row in srctbl, or else the result will not be predictable.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for

  • Error when installing CS5...

    Hello. When I was installing CS5 Master Collection, the power supply suddenly stopped. So when I re-install again after power supply back, then it had error showed "Your installation encountered errors. Please try restarting your  system and installi

  • IMovie 9.0.9 and Yosemite?

    Hi. I'm wondering if anyone is able to run IMovie 9.0.9 under Yosemite. Tonight I installed Yosemite on an external drive. I then tested all my applications to see if any had problems under Yosemite. Only a few did, but one was IMovie 9.0.9. It would

  • Organization structure for Inventory management

    Hi All, I am looking for organization structure specific to inventory management and also data flow architecture. If there is any standard org structure is available please share with me. Regards Vijay

  • SkyDrive (not SkyDrive Pro) does not sync anymore

    Hello guys, Recently I noticed that the built-in SkyDrive in my Windows 8.1 stopped working. If I see my SkyDrive folder on File Explorer, it always shows the blue sync arrow icon regardless of many hours I waited for it to complete. Sometimes I open

  • Lightroom Drop of quality exporting to jpeg

    Good Evening, I'm facing an issue with Lightroom 5.6. When I develop a photo and I export it to jpeg the result is far from the original Raw. There is a loss of quality, particularly in term of noise reduction and sharpening. It seems that Lightroom