By pulling the values of Variables for my Table of facts

Hi all

The Load_Date of my fact table is currently, current_timestamp-1, the data are a day old when it's loaded. I want to get that date to a variable, because if I need to raise with an earlier date like 20 or 30 days before the current date, I don't want to touch the map instead, change the variable and run the package. Please advise on how to do this?

Thanks for your time and your help.

Do not you have correctly, but you can create a variable of refreshment with query like select sysdate-20 of: double. And then, you can use the variable everywhere.
Thank you

Tags: Business Intelligence

Similar Questions

  • Defining the new path for the data files for restoring using the VALUE of NEWNAME FOR DATABASE

    Version: 11.2.0.3 Linux

    Today, I had to do a restore RMAN to a new server and I came across the post following RTO on the VALUE of NEWNAME FOR DATABASE

    ALTER database open resetlogs upgraded;         error to throw

    So, I thought to use it to indicate the new location of the data files to restore.

    That's what I did
    ===================

    Restore the control file and catalog items to backup using the command of CATALOGUE START WITH. Then I started the restoration
    $ rman target / cmdfile=restore.txt
    
    Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jul 26 04:40:41 2012
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    connected to target database: SPIKEY (DBID=2576163333, not open)
    
    RMAN> run
    2>  {
    3>  SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey';
    4>  restore database  ;
    5>  }
    6>
    7>
    8>
    executing command: SET NEWNAME
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of set command at 07/26/2012 04:40:43
    RMAN-06970: NEWNAME '/fnup/hwrc/oradata/spikey' for database must include %f or %U format
    
    Recovery Manager complete.
    Don't know how it worked for Levi without %f or %U. So, I added %f
     $ vi restore.txt
     $ cat restore.txt
    run
     {
     SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey/%f';
     restore database  ;
     }
    
    
     $ rman target / cmdfile=restore.txt
    
    Recovery Manager: Release 11.2.0.3.0 - Production on Thu Jul 26 04:45:45 2012
    
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    
    connected to target database: SPIKEY (DBID=2576163333, not open)
    
    RMAN> run
    2>  {
    3>  SET NEWNAME FOR DATABASE TO '/fnup/hwrc/oradata/spikey/%f';
    4>  restore database  ;
    5>  }
    6>
    7>
    8>
    executing command: SET NEWNAME
    
    Starting restore at 26-JUL-12
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=19 device type=DISK
    
    channel ORA_DISK_1: starting datafile backup set restore
    channel ORA_DISK_1: specifying datafile(s) to restore from backup set
    channel ORA_DISK_1: restoring datafile 00001 to /fnup/hwrc/oradata/spikey/1
    channel ORA_DISK_1: restoring datafile 00002 to /fnup/hwrc/oradata/spikey/2
    channel ORA_DISK_1: restoring datafile 00003 to /fnup/hwrc/oradata/spikey/3
    channel ORA_DISK_1: restoring datafile 00004 to /fnup/hwrc/oradata/spikey/4
    channel ORA_DISK_1: restoring datafile 00005 to /fnup/hwrc/oradata/spikey/5
    channel ORA_DISK_1: restoring datafile 00006 to /fnup/hwrc/oradata/spikey/6
    channel ORA_DISK_1: restoring datafile 00007 to /fnup/hwrc/oradata/spikey/7
    channel ORA_DISK_1: restoring datafile 00008 to /fnup/hwrc/oradata/spikey/8
    channel ORA_DISK_1: restoring datafile 00009 to /fnup/hwrc/oradata/spikey/9
    channel ORA_DISK_1: reading from backup piece /u07/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk
    channel ORA_DISK_1: errors found reading piece handle=/u07/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk
    channel ORA_DISK_1: failover to piece handle=/u07/dump/bkpfolder/SPIKEY_full_01nh0028_1_1_20120725.rmbk tag=SPIKEY_FULL
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:01:56
    Finished restore at 26-JUL-12
    
    Recovery Manager complete.
    As you can see, RMAN restore data files to the desired location. But the data file names ended up as
    1
    2
    3
    .
    .      
    .
    9
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -----------| Holy Cow |-----------------------------


    So I had to rename each file as below
    $ mv 1 /fnup/hwrc/oradata/spikey/system01.dbf
    $ mv 2 /fnup/hwrc/oradata/spikey/sysaux01.dbf
    $ mv 3 /fnup/hwrc/oradata/spikey/undotbs01.dbf
    I would have been better in execution of the order for each data below file
    SET NEWNAME FOR DATAFILE
    Now, I think, there is no advantage in using NEWNAME SET of DATABASE to. Only the disadvantages. I did anything wrong above?

    Martin;

    On the issue of the VALUE of NEWNAME FOR DATABASE, you must specify at least one of the first three of the following substitution variables to avoid collisions of names: %b f % U. see semantic entry for TO 'filename' for a description of the possible substitution variables.

    You use %f

    %b
    
    Specifies the filename without the fully qualified directory path. For example, the datafile name /oradata/prod/financial.dbf is transformed to financial.dbf. This variable enables you to preserve the names of the datafiles while you move them to different directory. During backup, it can be used for the creation of image copies. The variable cannot be used for OMF datafiles or backup sets.
    
    %f
    
    Specifies the absolute file number of the datafile for which the new name is generated. For example, if datafile 2 is duplicated, then %f generates the value 2.
    
    %U
    
    Specifies a system-generated unique filename. The name is in the following format: data-D-%d_id-%I_TS-%N_FNO-%f. The %d variable specifies the database name. For example, a possible name might be data-D-prod_id-22398754_TS-users_FNO-7.
    

    Source - E10643-01

    Backup and recovery reference

    http://docs.Oracle.com/CD/E14072_01/backup.112/e10643/rcmsynta2014.htm

    I see CKPT and I agree on that!

    Best regards

    mseberg

  • The value of variable binding VO on page load by program

    Hello everyone!

    I use JDeveloper version 11.1.2.3.0

    I am currently trying to get the filtered data to a VO, based on a WHERE clause with a variable binding. This process must be done on the loading of the page. I have set this variable for liaison with the id of the logged in user (the part to get this id is already reached and used somewhere else). My current approach is to define a bean managed with scope pageFlow. Inside of this, I have a method in which I get the id and I put it as parameter. The code snippet:

          BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("getUserIdFromUsername"); //getUserIdFromUsername is a method defined in the AppModule and exposed in the client interface
           operationBinding.getParamsMap().put("username", getUserName());
          Object userID = operationBinding.execute();
            setUserId(Integer.parseInt(userID.toString()));
           System.out.println("THE USER ID IS: "+getUserId());
           BindingContainer bindings2 = getBindings();
           OperationBinding operationBinding2 = bindings.getOperationBinding("ExecuteWithParams");  // i've dragged and dropped the ExecuteWithParams operation into the page
           operationBinding2.getParamsMap().put("userId", getUserId());  // userId is the bind variable which i'm talking about
            Object result = operationBinding2.execute();
    
    
    

    Then I call this method on BeforePhase in the view of the page. It works, I get the filtered data and the println shows me the correct ID. The problem is that whenever I select a row in the table showing the data, the page seems to reload and it always reload the selection at the forefront.

    What I am doing wrong? Maybe this isn't the right approach, that I saw a few other posts on this topic, but they are not very clear to me.

    Please advice

    OK, that's what I did. I created the method to set the value of the variable to bind to the query of the VO in the AppModule instead of inside the bean (this method also runs the query) and client presentation to the interface. After I have created the method call in the section of links the pagedef (where he gets the value of the id of the bean in the original post), and followed Cvele_new_account suggestion, calling the method as follows:

    RefreshCondition = "#{! requestContext.postback and empty bindings.exceptionList}" / >

    Thank you for the help guys!
  • Synchronize the values of variables of substitution between Essbase and planning

    Hello
    In EMP 11.1.2.1 version (but we noticed the problem also in previous versions of EPM) when we set the value of a variable substitution in Essbase, the value is not immediately updated in planning: for a while, we see the old value. The value in the planning remains unchanged even to disconnect or exit planning and reconnect.
    On the contrary if we restart the planning service, the value is immediately updated
    Since we would like to use the Essbase substitution variables to manage some selections in forms of Entru data planning, is it possible to force a synchronization, or increase the frequency of synchronization between Essbase and planning?

    Concerning

    Francesco Quaranta

    Take a look at the definition of ownership of planning SUBST_VAR_CACHE_LIFETIME

    http://docs.Oracle.com/CD/E17236_01/EPM.1112/hp_admin/properts.html

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • After select stmt. why the count value of variable column, nested table is zero.

    CREATE OR REPLACE TYPE numbers_type
    ARRAY OF INTEGER
    /
    CREATE OR REPLACE PROCEDURE p(i) in FULL IS
    numbers1 numbers_type: = numbers_type (1,2,3,4,5);
    BEGIN
    DBMS_OUTPUT. Put_line ("exposed before SELECTING");
    DBMS_OUTPUT. Put_line('numbers1.) COUNT() = ' | numbers1. COUNT());
    FOR j IN 1.numbers1. COUNT() LOOP
    DBMS_OUTPUT. Put_line ('numbers1 (' | j |)) ') = ' || numbers1 (j));
    END LOOP;
    -Auto selection clause to COLLECT LOOSE:
    SELECT a.COLUMN_VALUE
    LOOSE COLLECTION numbers1
    TABLE (numbers1) one
    WHERE a.COLUMN_VALUE > p.i
    ORDER BY a.COLUMN_VALUE;
    DBMS_OUTPUT. Put_line ("presentation and SELECT '");
    DBMS_OUTPUT. Put_line('numbers1.) COUNT() = ' | numbers1. COUNT());
    END p;
    /
    Call p:
    BEGIN
    p (2);
    END;
    /

    Hello

    Before taking in the collection variable, the values of the variables are fushed. So in this case the numbers1 is empty so it becomes zero and trying to read values from this collection which is already empty.

    That's why you get the number zero

    PRABHU

  • the value of variables in the text box.

    I write a code that has a function of function there is a table of the different variables of table, values come from Server I'd like
    Enter this value of var in the text box.

    It's like in the code file is like this

    public void mainMenu (rcvParametersArray:Array): void {}

    var IndianMenu:int = rcvParametersArray [0];
    var chainesMenu:int = rcvParametersArray [1];
    }

    Assuming a component textArea on the stage, something like the following should work (composed an array to pass to the):

    var theMenus:Array = [1,2];
    mainMenu (theMenus);
    function mainMenu(rcvParametersArray:Array):void {}
    var IndianMenu:int = rcvParametersArray [0];
    var chainesMenu:int = rcvParametersArray [1];
    arrayDisplay.text = IndianMenu + ', ' + chainesMenu;
    }

    However, it seems that he might extend to several items, I was wondering if maybe you don't want to have an array of arrays so that the menu name is incorporated with its index or regardless of the other properties are associated with. Maybe not, but I thought that I would say something like the following in case it is useful

    var theMenus:Array = new Array ({name: 'Indian', index: 1}, {name: 'Channels', index: 42});
    mainMenu (theMenus);
    function mainMenu(rcvParametersArray:Array):void {}
    for (var i: int = 0; i< rcvparametersarray.length;="">
    arrayDisplay.text += rcvParametersArray [i] .name + "" + rcvParametersArray [i] .index + "\n";
    }
    }

    Finally, if the values in the table of your original paintings are numbers or integers (ints), you can convert them to strings before displaying using the toString() function, unless they are be concatenated with an existing string.

  • How to store the values of variable level OBIEE presentation in DB

    Hi all!

    We have a command prompt of dashboard which is set up to store values in variables of presentation (period start and period end dates). Is there a way to store values selected from a database? for further processing?
    that is, I need to pass the variable level (report parameters) presentation to complex calculations to a PL/SQL function.
    Also my requirement might be solved if I can get access to the selected values of logical column in the tab 'Business Model and mapping' definition in the BI administrator.
    that is, I'll be able to define the logical column using VALUEOF (NQ_SESSION. < nom_var >)

    Kind regards
    Mr.Maverick

    Hello.

    1 do SQL PL/function (in the database) which has an input parameters, which number depends on number of guests and in it you'll insert these parameters into a table.

    2. your report in column expression answers call this function that will do insert, the code would be like:
    EVALUATE ("YOUR_FUNCTION (1%, 2%, 3%, 4%) (' as varchar (20), @{p_1}, @{p_2}, @{p_3}, @{p_4})

    3. Note that the function returns something and be careful on data types inside EVALUATE it.

    4. notes that, in the case where some messages are not selected (all or nothing) you recognize this case as:

    -case when LENGTH('@{pv_var}') > 0 then ' @{pv_var}' end else' all '.

    or like this:

    -case when LENGTH('@{pv_var}') is null then 'all choice"other" @{pv_var}' end; "

    Kind regards
    Goran
    http://108obiee.blogspot.com

  • Does not restore the values of form for the restoration of the tab

    Part of my Web site uses a large number of forms on a single page. On the page, you can filter items (each item has its own form) and modify them. One entry looks like this: [name] [select status] [other Select]. Other important things are that the document has an expiration date in 1981 (to apply a page always up to date) and that change the value in the select results in the triggering of an AJAX function.

    It works perfectly, except for one thing. When filtering State id 1, you get back a little of the element. Let's say that the result of the filter are input 5. Change entry #2 status, which triggered an AJAX function. It works very well, but here's the problem: when close the tab and re-opening with Restore tab, select values become disheveled.

    Due to the execution of a fresh copy of the page, the browser will get a new copy of the page. Entry #2 is now gone (I'll keep calling it that, even if she disappeared because of the filter). Now, here's the problem: Firefox is attempting to restore the value to select it. Entry of the status #3 now has the same status of entry #2, #4 a #3 status and so on.

    I managed to solve this problem on other browsers (Chrome, IE) with this little piece of jQuery:
    {$(document) .ready (function ()}
    {$("form[class^='startingformname']").each (function ()}
    This.Reset ();
    })
    });
    It works perfectly, except for Firefox, which seems to ignore the call to reset...

    As this text is quite long, I'll keep my short question: How do you keep Firefox restore the values of the form (preferably: keep them on the selected item in the HTML)? Now, the user always gets a new copy of the page, and Firefox is trying to restore the old values on this page, even though the HTML code has changed.

    I think your two choices is:

    (1) prevent Firefox from page caching, or

    (2) use a different event to trigger your reset function

    As I understand it, the function $(document) .ready jQuery () raises the event DOMContentLoaded (or equivalent, if not supported by the browser). If the tab is cached in its ' cache fast back-forward ", Firefox can not fire this event when the user returns to the tab, just like Firefox does not always raise the load event in such cases.

    Discover the event more described in the following article and see if you can use it to trigger your reset function in Firefox: https://developer.mozilla.org/docs/Using_Firefox_1.5_caching

    Who is?

  • PS possible bug on Wondows? Value of the radius of the value 0.1 for filter | Sharpen | Smart Sharpen does not at all.

    Hello

    I'm running the PS latest version 2015.1.2 (subscription) - 20160113.r.355 x 64
    I installed it on a Windows 10 computer and on a MAC El Capitan (OS X 10.11).

    But there is a difference in what a certain sharpening setting does not work on the Win10 PC.

    I chose:
    Filter | Sharpen | Sharpness...

    From there everything works OK on the Mac.
    But on the PC, a framework does not at all and it is if I set the RADIUS to 0.1.
    All other values respond normally, while the 0.1 parameter is simply dead (respond well on MAC).

    I (re) installed PS in Norwegian and English (International), but the problem is persistent.
    This could be a bug in the version of PS window?


    Concerning


    Erik Aaseth

    Norway

    Solved!

    When you enable more "accurate" for sharpness (under the gear wheel), the value 0.1 works too!
    But w / just "use Legacy" checked (by default), there is not admissible.

  • the value of variable equal to the value of a recordset from database

    It is for Coldfusion version 8.

    I have two tables which I am inserting data in. After I insert a record in the first table, I need to use the id (auto incremented, not something I already have) to the new folder as part of the data I enter in the second table.

    I'm having a hard time nailing down the syntax to get me there. I searched the documentation, any thoughts on what I should have sought under would be welcome as well.

    Any help would be appreciated, thanks.

    -----------------------------------

    <!-this table contains a column id that autoincrements->

    < cfquery datasource = "labdsn" name = "newLabDataRecord" > INSERT INTO LabData (savedLab, lastSavedBy) VALUES ('data data data", '555') < / cfquery >

    <! - find the value of this new identifier - >

    < cfquery datasource = "labdsn" name = "maxLabIDRecord" > select max (id) OF LabData < / cfquery >

    <!-this generates the error. Not surprised, but don't know what it should be->

    < cfset maximum = < cfoutput query = "rsMaxLabIDRecord" > #rsMaxLabIDRecord.id # < / cfoutput > >

    < cfquery datasource = "labdsn" name = "newUserRecord" > INSERT INTO UsersVsLab (userID, whichLab, IDB) VALUES ('2', 1, < cfqueryparam value = "#maxID #" >) < / cfquery >

    <!-it's another syntax I tried->

    <!-cfquery datasource = "labdsn" name = "newUserRecord" > INSERT INTO UsersVsLab (userID, whichLab, IDB)

    VALUES

    ('2', 1, < cfqueryparam value = < cfoutput query = "rsMaxLabIDRecord" > #rsMaxLabIDRecord.id # < / cfoutput > >) < / cfquery->

    You can solve your specific error by adding an alias to the application where you get max id.  However, there are often better ways to achieve this.  The details depend on the type of db that you use.

    If you need to use max (id) select, add a where clause clause in order to make sure you get the right pair.

  • Display the values of variables

    I'm working on a Captivate 5 project in which the values of the variables are assigned and then reassigned. Is it possible to display the value of a variable in a text box or other window to ensure that the value changes? Thank you.

    Darin

    Hello David,.

    It's the way I am especially debugging advanced actions by inserting the variables used in a text of the legend Rick indicates. A long time ago that I wrote two articles on the basic use of variables, perhaps reading could specify:

    Use the power of variables without advanced actions

    Unleash the power of variables with advanced actions

    CAUTION: sometimes the update does not appear immediately. In another thread, I explained how you can refresh the contents of the enhanced TextArea widget that contains a variable that is filled with another widget on the same blade.

    Lilybiri

  • Select the list with propose pulling the values of %

    Hi all

    I have a tabular presentation of data app and from views of the choices selected in the 'list of selection with submit' the post, it works very well for the chosen values, when I choose '%' I want to display all existing records in the form of tables, but instead he said: "no data found". How to solve this? Kindly help and advice.

    ex:

    Query tabular-

    Select a, b
    table
    When a type: POINT

    Agenda:

    Type: select the list to submit
    Named LOV:
    Select a d, a r
    from table_recherche by 1

    Receive your answer.

    Thank you and best regards,
    Senana

    Hello

    You have to check what is the value returned by the selection list when you select '%' in the select...
    There is a null value to display field where you can enter '%' and the return NULL value you enter 0

    then change your query in a table
    Select a, b from table when one like: POINT GOLD: ITEM = 0

    Kind regards
    Shijesh

  • need to change the value of variables without deploying

    I need to code of values to variables and need to change the value of the variable without redeploying code.

    BPEL properties
    It is possible to have properties set in the BPEL process. Properties are set on a global scale and outside the BPEL process. The properties are accessible via an internal function.

    In the bpel.xml file, add the following lines just before the end of:


    [email protected]

    Properties are available in the BPEL process (.) BPEL file) via the function ora: getPreference():

    Ora:getPreference('propertyEmailAdress')

    You can change this value in console deployment descriptors

  • View the value of variables

    The following procedure, I wrote, and when I run my out parameters is not any value. I want to fill in the parameters out of my selection. How to display values?

    PROCEDURE Retrieve_Item_And_MeasureUOM
    (
    -parameters passed in
    p_wr_item_oid in NUMBERS
    p_wr_measure_oid in NUMBERS
    p_measure_uom OUT VARCHAR2,
    p_report_item_measure_uom OUT VARCHAR2
    )

    As
    -local variables
    v_sql1 varchar2 (500): = ";
    v_report_name varchar2 (200): = "reportname";
    v_wr_item_oid NUMBER;
    v_measure_oid NUMBER;
    v_report_item_measure_uom VARCHAR2 (5);
    v_measure_uom VARCHAR2 (5);

    BEGIN

    v_sql1: =.
    "SELECT."
    FM.wr_item_oid, fm.wr_measure_oid, fm.default_display_uom as Report_Item_Measure_UOM,
    m.Default_UOM_App_Code as Measure_UOM
    IN
    v_wr_item_oid, v_measure_oid, v_report_item_measure_uom, v_measure_uom
    Of
    wr_form_measure fm
    JOIN IN-HOUSE
    m wr_measure ON m.wr_measure_oid = fm.wr_measure_oid
    WHERE
    FM.wr_item_oid =' | p_wr_item_oid | "and fm.wr_measure_oid = ' |" p_wr_measure_oid | ' AND
    FM.wr_form_oid =' | Retrieve_FormOID_From_Name (v_report_name);


    EXCEPTION

    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR (-20999, "no data found. Possible error in the form OID.') ;

    END Retrieve_Item_And_MeasureUOM;


    When I run the query, the out parameters show this:

    p_measure_uom =
    p_report_item_measure_uom =

    Hello

    Maybe I missed something, you set a query with "v_sql1" but I don't see where it run you?

    I mean usually in PL/SQL that you define a CURSOR with a query. Then on a LOOP, you GET it
    each row returned by the query results.

    If you have a unique value to EXTRACTION you can write directly in your query as follows:

    SELECT col1, ... INTO v_1,...
    FROM ... ;
    

    Then, in this example, v_1 takes the value of col1.

    Hope this helps.
    Best regards
    Jean Valentine

  • To access the values of checkbox for the treatment

    OK, this topic has probably been beaten to death here, but I can't find relevant discussions or sort of do what I do work. Basically I have a report with a list of entries that can be added to a table. This table can be found be a "join table" which allows for a many-to-many join with the primary keys of the installation of two related tables in a primary key composed for the junction table.

    I have this process in the page that is supposed to make the appropriate insertion:
    -- insert or update assignment requests
    -- loop through the rows and do an insert for each selected row
    BEGIN
     FOR i in 1..apex_application.g_f01.count LOOP
      -- do an insert based on the selected rows
      insert into itil_svc_aud_join (service_id, audience_id, consumer, can_order)
      values(:P52_SVC_ID, apex_application.g_f01(i), apex_application.g_f02(i), apex_application.g_f03(i));
     END LOOP;
    END;
    : P52_SVC_ID is a popup LOV that saves its state value, g_f01 is a checkbox in the first column of the table, g_f02 and g_f03 are additional columns that I create in the report running through functions apex_item.checkbox.

    To this, the insert very well, it is simply not put in the values that the user could have selected the second and third boxes.

    Here's my query to create the report.
    select 
    apex_item.checkbox(1, b.audience_id) chk,  
     b.name audience, b.comments,
     apex_item.checkbox(2,0) cons_chk,
     apex_item.checkbox(3,0) order_chk
    from  itil_svc_audience b
    where  b.active = 'Y'
    and b.audience_id not in 
     (select audience_id from itil_svc_aud_join 
      where service_id = :P52_SVC_ID)
    As you can see from this that the second and third boxes are not an actual table columns, I just need them out there to get the change in status of the user during execution. Do a query of the join table is not an option because the records do not exist right now in this table.

    In any case, the point is that my insert do not enter values of the tables g_f02 and g_f03 application and forward them correctly. It's driving me crazy. Do I have to check the State of the people before you run the insert operation? I think I've done this before, but for the life of me can not find out how to get these values in the table. Any help?

    Earl

    Hi Earl

    I am happy that it works, although I'm not 100% convinced that your changes would work in all cases. Make sure you give him a good beating and test all possibilities. In addition, with 3 separate DML instructions I guess you should consider blocking update records.

    Shunt

Maybe you are looking for