Updating a timestamp when a column value changes

Hi,
currently i have a table that stores an assigned_to column and an assigned_on column.
what i would like to do is update the assigned_on column with the systimestamp when the old value of the assigned_to column is not the same as the new value.
i have tried using a trigger to fire when :new.assigned_on != :old.assigned_on, however, i experience the mutating table problem.
i have looked around and tried using 3 triggers (before and after row and after statement) in conjunction with the package, however, have not been able to fix it.
can someone suggest an alternative, short of putting the the assigned_on value into a different table.
i already have a trigger that is copying the the row across to a log table, but i don't think that is causing the mutation errors.
your help and suggestions are greatly appreciated in advance.

SQL> create table t (assign_to integer, assign_on timestamp);
Table created.
SQL> create or replace trigger tr_01
  2  before insert or update of assign_to
  3  on t
  4  for each row
  5  when (new.assign_to != nvl(old.assign_to,0) and new.assign_to is not null)
  6  begin
  7   :new.assign_on := systimestamp;
  8  end;
  9  /
Trigger created.
SQL> insert into t values(null,null);
1 row created.
SQL> select * from t;
ASSIGN_TO ASSIGN_ON
SQL> insert into t values(1, null);
1 row created.
SQL> select * from t;
ASSIGN_TO ASSIGN_ON
        1 12.09.05 14:49:16.234000
SQL> update t set ASSIGN_TO = 1 where ASSIGN_TO = 1;
1 row updated.
SQL> select * from t;
ASSIGN_TO ASSIGN_ON
        1 12.09.05 14:49:16.234000
SQL> update t set ASSIGN_TO = 2 where ASSIGN_TO = 1;
1 row updated.
SQL> select * from t;
ASSIGN_TO ASSIGN_ON
        2 12.09.05 14:49:42.890000Rgds.

Similar Messages

  • I want the system automatic update my UDFs when the OnHand was changed.

    I added two UDFs in table OITW to count the warehouse OnHand by CASES and Bottles. I want the system automatic update my UDFs when the OnHand was changed.  Is there any way I can do it in database level instead in the application (too much places involved).

    There is few ways how to do this:
    - triger as David said, but I dont recomend it through SAP policy
    - in stored procedure transaction notification  by adding or updating document update your user field
    - create job in SQL server which in specific interval recalculate the changes of onhand and update your user defined field
    - create addon which will be over functiuonalities which may change the onhand value
    I think that from SAP is possible only Addon, but the easist way is trigger and if you dont need it just in time but for example every 10 seccond, the better is job which cannot fail the standard SBO transaction (triger may and may be unsafe).
    Hope it helps
    Petr

  • Using md5 in a manul tabular form to compare if column value changed

    Version: Application Express 3.2.0.00.27
    Hello,
    I am creating a manul tabular form using apx_item in my select statment that is the source for the query in a report region. I am using a collection. The collection creation statement is:
        apex_collection.create_collection_from_query(
           p_collection_name => 'DELEG_COLL',
           p_query           => 'SELECT authid
                               ,empid empid
                               ,to_char(deldate,''DD-MON-YYYY'') deldate
                               ,delscope delscope
                               ,dellimits dellimits
                               ,subdelrights subdelrights
                               ,to_char(delexpiry,''DD-MON-YYYY'') delexpiry
                               ,to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved
                               ,delremovalcomments delremovalcomments
                               ,delegator delegator
                               ,''O'' original_record
                               ,wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)
                               FROM tbl_delegations
                               where empid = v(''P12_EMPID'')',
           p_generate_md5     => 'YES');The above code is giving me an error in the function
    wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)It doesn't seem to like where I attempt to convert date column delexpiry and datedelremoved to a varchar. I am doing this as in the db they are dates and inorder to using the md5 function to compare if the values have changed and only update rows where the values changed.
    There error that I get is:
    ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00907: missing right parenthesis
    In the collection I am trying to store the md5 hash result. I haved all the update and insert logic working expect for date type columns. THose give the above error.
    I thank you ahead of time for your assistance!
    A. Shalon

    Helen,
    Not sure I fully understand your goal.  We don't use "tasks" at all but if you are looking to have your workflow check certain valus and be able to send email messages to people based on whatever, then you can certainly do that (as long as your Sharepoint
    has the email setup.  We do this for alot of workflow tasks.
    So, in the workflow you can have a blanket statement like what I previously listed:
    if Current Item:hiddenStatus  not equals Current Item:Status
        .... do something
    or you can do something like:
    if Current Item:hiddenStatus equals "In-Progress"
        .... do something
    Else if Current Item:hiddenStatus  equals "Completed"
        .... do something
    or combine the two and do nested "if" statements.  Then you add an email statement wherever you need it like:
    if Current Item:hiddenStatus  equals "Completed"
       then email "these users"
    To add the email part, just type in "email" on the line where you want to add a statment.  There is only one option to choose from.  That will display the line "then email these users".   The "these users" will be a link.  When you
    click it you will get a popup to add the email info.  We typically will send the email to a user (or users) that are already listed in one of the PeoplePicker fields.  On the email form, you can type in your own text, designate that a value is based
    on a column value (like our PeoplePicker), designate that a value is based on a workflow variable, add a link to the current item, etc.  To get to these options you will click the button to the right of the fields or use the "Add or Change Lookup" button
    in the bottom-left for the text area.  There is alot you can set in the mail.
    Does this help answer your question?
    - Peter

  • Require field be filled out when other field values change

    I tried to search on something I need to do but couldn't come up with a combination of words to find much.
    I have a situation where, when certain field values on a form are changed, I need a comment field filled in. So if one of the designated field values change and the comment field is NOT filled in, I would like some kind of message indicating that the comment field must be filled in when that field is changed. This would preferably happen when the 'Update' button is pushed on the form. And this would need to happen before the data is submitted.
    This seems to be somewhere between a validation and a Dynamic Action. I'm not sure how to go about creating what I need. Any help would be greatly appreciated! Hopefully I have described the scenario well enough.
    Thanks!
    John

    This did the trick! I created the hidden item, then created a dynamic action that would set the value of the hidden item to 1 if the field changed (action = 'change'). Then I created a validation on my 'comments' field to check if it was NOT NULL when the 'Apply Changes' button was pushed, with a condition of the hidden item = 1.
    One thing extra - I had to set the dynamic action so that it did NOT fire on page load. Otherwise it would set the hidden item to 1 when the page loaded after clicking the "Apply Changes' button.
    So, thanks!
    One other question - I have a lot fields on this form. All of them have this requirement except for a few buttons. Is there any way to list the fields NOT to look for a change. In other words, in the Dynamic Action section, in the WHEN section, is there a way to designate items NOT to look for a change?
    Thanks for the help!
    John

  • Is it possible to generate a user event when shared variable value change on RT target?

    Hi,
        I wonder if it is possible to generate a user event when a network published shared variable value change?
        Thanks a lot!
        Regards,
        Tom

    Tom,
    I understand not wanting to waster resources on polling but I am not aware that LabVIEW can automatically generate an event on a SV change.
    Maybe a better solution...
    You could implement lower level TCP communication (i.e. have a look at STM - simple messaging protocol) for passing data betweeen RT and PC (instead of using a SV).  You could send a generic command (boolean trigger maybe?) from your RT system when the value of whatever it is the SV is storing has changed.  You can avoid polling on the non-RT system this way.
    Dan

  • PDA build error when using a 'value change' event on two controls

    I get a build error when I use a 'value change' event on controls of a different type or even a different numeric representation. I'm using LV 7.1 PDA with no other modules installed. Attached is a picture of the entire code and the error message.
    Try to take over the world!
    Attachments:
    PDA Error.jpg ‏48 KB

    Hi,
    I verified the error that you are seeing. It appears to be a bug hence I have reported it to our developers. Hopefully this bug would be fixed in the next relaese of the PDA module.
    Thank you for pointing this to us. It is through feedback that we can make LabVIEW PDA module even better.
    Regards,
    Ankita A.
    National Instruments

  • Shade Excel Rows When a Text Value Changes

    How would I tell Excel to format background fill in rows when a value changes?  Chandoo posted this challenge and many people have answered, but I cannot get any of their proposed solutions to work properly.  This would be a handy trick and it
    should not be hard.
    Doug in York PA

    Looks like you have already got the correct formula, the only thing you need to do is create a conditional formatting. What's the trouble did you meet ?
    Also you can try this formula:=ISODD(SUMPRODUCT(1/COUNTIF($A$2:A2,$A$2:A2)))
    Wind Zhang
    TechNet Community Support

  • Calculating based on a previous value when initial column values differ from the rest

    Let me preface this by saying I am new to the BO world. I'm trying to build a report/chart that tracks incoming loads. The first supply on hand value is pulled from the database and each successive supply on hand is based on the previous row's values.
    In the supply arriving column below, the iniital value differs from the rest using the formula:
         =If [Row Number]=1 Then [First Supply Arriving] Else [Supply Arriving]
    The supply on hand uses the same idea, but is where I'm running into problems. The first column value should be [Supply On Hand], easy enough. Each successive column value needs to follow this equation:
         Previous([Supply On Hand] (this won't always be [Supply On Hand] though, only for the second row essentially - problem 1) + Previous([Supply Arriving] (same as problem 1, where this is first supple arriving for the second row and then supply arriving moving forward) - [Usage Rate]
    If someone could help me in getting the calculation to pull the previous values correctly without making a ton of variables, I'd greatly appreciate it. We just upgraded to 4.1

    Yes, the supply on hand and the supply arriving from the previous row need added together. The usage rate, which is a constant is then subtracted from that. The result is the on hand total for the next day.
    For example:
    Date
    On Hand
    Arriving
    Usage Rate
    9/9/2014
    100,000
    250,000
    100,000
    9/10/2014
    250,000
    1,000,000
    100,000
    9/11/2014
    1,150,000
    0
    100,000

  • Summary column value changing to NULL in RDF

    Hello Everybody.
    For the existing query column in RDF, which is used by one of the summary column as source.
    If the query is getting changed as per the bussiness requirement, the source of the Summary column is changing to NULL.
    Is there any way not to allow this change in RDF. Because lot of query modifications are done.And it consumes lot of time to change every source of the Summary columns being used.
    Appreciate your help.
    Thanks.

    In general this shouldn't happen. Did you define proper ALIAS'es for the column the summaryitems are based on?

  • When Requested for a Grand Total the column values changes to zeroes

    Hi,
    I have a report with 2 dimensions and 4 facts. The report is showing the correct data when compared with EBS, but when we are applying grand total in Table View then for fact values are displaying zeroes. However the grand total is correct but for some dimensions the measures are displaying zeroes.
    At this point i have modified the Aggregation rule of 1 measure from Default to SUM and when i clicked results Wonder, i can see grand total and the zeroes were replaced with actual values. When i have compared logical queries before applying the aggregation and after, the measure is surrounded with function REPORT_AGGREGATE and REPORT_SUM respectively.
    Can anyone explain me why is this behavior occurred, i got the solution but i am not in stage to explain to client why it happened.
    Kindly help and i will make sure it is definitely marked.

    Re:  Bottom Line Grand Total
    Use the Subtotal function instead of the Sum function for all totals.
    The Subtotal function ignores other Subtotal functions in the column you are summing.
    Your three "Sum" functions would look something like...
    =SUBTOTAL(9,J3:J7)    '300
    =SUBTOTAL(9,J8:J14)  '900
    =SUBTOTAL(9,J3:J14)  '1200
    '--- Info
    1    AVERAGE
    2    COUNT
    3    COUNTA
    4    MAX
    5    MIN
    6    PRODUCT
    7    STDEV
    8    STDEVP
    9    SUM
    10    VAR
    11    VARP
    Jim Cone
    Portland, Oregon USA
    free and commercial excel programs at...
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • Automatically update Data Flow when table column is added

    Hi, I have identical SQL Server databases on Server A and Server B, and I'm trying to create an SSIS package that will update its own Data Flow task when I've added a new column.  
    When I open the SSIS package up in Data Tools after adding the column, I get the following warning: 'The external columns for OLE DB Destination are out of synchronization with the data source columns. The column "TestColumn" needs to be added to
    the external columns.'  So the package know when it's out of sync with the db.  
    Is there a way to automatically update the external columns?
    Thank you!

    There is a Dynamic DTS task commercial product of CozyRock
    Another possibility is to generate an updated version of the package programmatically either with BIML http://www.mssqltips.com/sqlservertip/3124/generate-multiple-ssis-packages-using-biml-and-metadata/
    or via .net code http://msdn.microsoft.com/en-ca/library/ms345167.aspx
    Arthur
    MyBlog
    Twitter

  • Column Value change in BO report vs HANA calculation view

    Hi,
    We are having BO  reports on  Standard hana views.
    We have some columns  in calculation view as below in Hana studio
    Column Name     Column Purpose
    1.Cost Center---(Gives cost center number)
    2.Cost center Name--(Gives description of cost center )
    3.Cost Element-which --(Gives cost center number)
    4.Cost Element Name-(Gives description of cost center)
    when we preview the data with these coulumns in hana studio there are giving the result as specified above.
    But if I run the report in BO using the above 4 columns ,I could see only descriptions for all the four columns as below
    1.Cost Center---(Gives description of cost center)
    2.Cost center Name--(Gives description of cost center )
    3.Cost Element-which --(Gives description of cost center)
    4.Cost Element Name-(Gives description of cost center)
    As per our requirement we should get numbers for cost center and cost element.
    I have observed in semantics that cost center and cost element have label columns mapped to them as below
    cost center has labelcolumn as costcenter name
    cost element has labelcolumn
    Please see the attached file . Is this happend because of the labelcolumn mapping
    we want the cost center and cost element to be displayed as numbers only.  Please suggest me on this.
    Thanku

    Hi Chandra,
    TEXT is coming because you have defined as "Label Column" . In HANA, Data preview the column names will only come but not "Descriptions".
    What is your reporting tool?  If it is AO, have a look on the below blog:
    Using Text Joins to enrich Attributes with "Texts" in SAP HANA with SAP BO Analysis Office
    Regards,
    Krishna Tangudu

  • Updating numeral list in a column after changes

    Hi there,
    I have created a simple table (with two columns) for a list of movies. The first column is a 3 digit numeral number and the second column is the title of the movie as per example:
    004 Star Wars A New Hope
    005 Star Wars Return Of The Jedi
    followed by a 300 plus list.
    My question is how do I update the film count once I have inserted Star Wars The Empire Strikes Back in its correct position, please? (ie all the following films will have to have their numbers incremented by 1, Star Wars Return Of The Jedi would become 006 and so on)
    Thanking the community in advance

    It can be done:
    Add a row above or below and insert Star Wars The Empire Strikes Back in the second cell. Leave the first cell blank.
    In the first column select 001 and 002 cells, move the pointer to the bottom of 002 until a yellow autofill handle appears, and drag it down.
    It's better explained here:
    http://help.apple.com/pages/mac/5.2.2/#/tan3af7438f2
    Autofill sequential content or patterns into adjacent cells: Type the first two items in the series in the first two body cells of the row or column you want to fill; for example, type A and B. Select the cells, move the pointer over a border of the selection until a yellow autofill handle appears, then drag the handle over the cells you want to fill.

  • Is there a way to get notification when column value is updated ?

    Is there a way to check when a column value has been updated?
    Example: "Project Start Date" has changed from March to June. RMS report will be sent via iBot to notify users.

    Find out if (in your country) there is a landline phone with a "ring" light on it. (In some countries, it's possible to buy a phone which is easily plugged in at home by the user.)

  • Identify when a user has change value in USEREXIT_CHECK_VBAP before saving

    I originally posted and closed this question, but I am still struggling with the code.
    The req is now to also update the value of VBAP-LPRIO, so I now have to use the Exit : USEREXIT_CHECK_VBAP.
    The issue is that my solution must take into account when a user manually overwrites a value and not replace it with a value determined in the user exit.
    My problem is that the user might do the following
    1 - Create a sales order and enter a new item line, press enter
    2 - The user exit is triggered, and I check that XVBAP-UPDKZ = I  (user add a new line)
    3 - The user-exit determines the new value and populates the field
    4- the user then click on the item line, and then manually changes the value of VBAP-LPRIO
    5- The user-exit is triggered again, and because  XVBAP-UPDKZ = I , my code is triggered and updates the field.
    What I want is to identify that a user has manually changed the value and not overwritte the value.
    1 - I have check YVBAP and it is blank, as the user has not saved the sales order.
    2- The values of VBAP and XVBAP are the same..
    3 - I cannot re-read the database (KNVV) table as the user could have populate the value with the same value.
    What I need is how to identify when a user has made a change to a field before they save the sales item, as YVBAP is never filled.
    Previous post----
    Hello,
    I am writing a bit of code that will overwrite the payment terms in a sales order item based on a number of factors. (ship-to, incoterms, document type, etc)
    I am using the following program MV45AFZB at Exit : USEREXIT_CHECK_VBAP. I am using this exit as the users need to see the payment terms after an item has been entered into the sales order and not have the value determined at sales order save.
    I am not using USEREXIT_MOVE_FIELD_TO_VBAP as it is only triggered once at the time of creation and not when I change the document. I need it in USEREXIT_CHECK_VBAP as users could change the incoterms in VA02, so the code must be redetermined.
    My code is working as expected, however, I have a problem when a user enters a sales order item line and then manually changes the payment terms, as my code then is over writes the users values.
    The flow is as follows
    As user creates a sales order
    They populate the sales order header
    They populate material number and qty
    User exit USEREXIT_CHECK_VBAP is triggered and correctly determines the payment terms
    The user then double clicks on the sales order item and decides to overwrite the payment terms.
    My user-exit is retriggered and check to see if XVBAP-UPDKZ = I (insert)
    As it is still an insert, my code triggers.
    I have tried to check YVBAP, but no entry exist as it stills is seen as in insert? What I really need to know that while it is still an insert, the user has change the field value and my code should not over write the users value.

    When do you need to update LPRIO ? When user makes the change at the Payment terms on line item?
    Regards,
    Naimesh Patel

Maybe you are looking for

  • Alert Proxy system or application through  RUN TIME WORKBENCH of PI

    Hi  friends, I am using PI 7.0  and at one scenarios we are communicating PI to another SAP system through  proxies.  PI 7.0 ==>  Proxies-->  SAP SYSTEM. Now we setup the alert at PI system through alert category and run time workbench. Is it possibl

  • How to open Sony SX100M3 Raw files in CS5? [was: Ryo]

    This week, I bought a Sony SX100M3. I don't transfer my photos on Photoshop-Bridge CS5. Why? Update?

  • Ons.log errors

    I have a 10g grid console installed configured and working. However thirty four error lines a second are written to the ons.log file. The error is: 05/05/02 12:59:42 [4] Local connection 0,127.0.0.1, 6100 missing form factor. The above line is repeat

  • Billing release to accounting error

    Dear experts, Because profit center couldn't be carried into billing from Outbound deliv.  then while relasing billing to accounting ,it tips error message. Thanks.

  • Converting psd photos to jpeg

    I have edited certain photos in Photoshop Elements 11 (using the Expert guide for advanced editing techniques)and for some reason, these photos were converted to a psd format. Now I cannot seem to be able to upload these psd photos to an outside Phot