Update trigger: identify which field changed

Is there any way to identify which field was changed when an update trigger fires? I need to be able to update another field if any field excluding 1 was changed.
Something like
for each field in :new
if field.name != "dateref" then
if field.modified then
altered=true
exit for
endif
endif
next
if altered then :new.updatetype="A"

This will do it
CREATE OR REPLACE my_trigger BEFORE UPDATE
OF col2, col3, col4 ON my_table FOR EACH ROW
BEGIN
  :new.updatetype='A';
END;
/If your table has a lot of columns this will be a bit of a drag to type all those column names. Unfortunately, as far as I know, there is no OF ALL COLUMNS EXECPT col1 ON
syntax.
Cheers, APC

Similar Messages

  • Which field changes will bring the delta into BW

    Hi,
    On which field changes the delta will bring data into SAP BW. let us say if you bring the data from 2LIS_13_VDITM, any key figure changes in VF02 will bring the data? Only few characterstic changes it will bring the delta data. What and all those characterstics for delta identifies?
    Let us say I have added few fields in this extractor from custom table, If I would like to bring the delta for the field changes which lies in custom table, Can I do it by creating custom Business Transaction Events?
    advance thank you very much.

    Hi SHarsha,
    delta update implemented using the characteristic 0RECORDMODE, it describes records to be updated or added.
    Alex

  • Identifying which field is active

    Hello,
    I'm trying to find a way to identify which input field is active, ie. which field has the curson in it and has focus in a group of JTextFields.
    An InputVerifier object can give me the field information - name and value - after moving from the active input field (TAB or mouse movement) but I want to know details of the active field - name and current value - whilst editing the characters in this field.
    I'd also like to be able to identify all cursor movements and all character edits in this field if possible.
    Can anyone help?
    Brgds John

    Listening for Changes on a Document
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#doclistenersListening for Caret and Selection Changes
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#caret

  • How to find which field is erroring

    Hi
    Can anyone out there tell me if there is a way in Forms 6i to find out which field on a block is raising an error? I have a situation where entering duff data into a field causes an error to be raised (the ON-ERROR trigger for that block is fired) but the same error is raised three times and the user has to acknowledge all 3 messages. I'd like to know whether it is the same field raising the same error 3 times or if other fields are also raising an error.
    Aside from putting ON-ERROR triggers on each of the fields, is there another approach I could take? For example, is there a system variable to identify which field is raising the error?
    Thanks and regards, Geoff

    The ON-ERROR trigger doesn't appear to do much at the block level - it contains a call to a library which appears to be an event handler, but I haven't looked into that in detail. I was more interested in working out which field(s) were raising the error in the first place!

  • Send designer workflow email when certain fields changed?

    Is there any way we can handle SharePoint designer workflow sending email. If certain fields only changes. 
    Like checking with previous value and and current values, if it is different and send email. Now I am able to sending email when list item changes, it doesn't matter which field changes. That way emails are flooding into inbox. 
    I want send emails when couple fields changes only. 
    Help is appreciated 
    ItsMeSri SP 2013 Foundation

    Yes very much possible to send email of specific fields change, however workflow will run on each edit but only proceed further when those specific field changes. Keep some hidden column which always will keep changed value for those column. When new value
    suppose to change, check with this hidden column values, if different then send mail and update else, stop workflow.
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Update Trigger: New Value

    Hi, I am in a strange situation, hope some one can help me. I have a BEFORE UPDATE trigger in which I have a condtion like.
    IF :new.col1 is NULL THEN
    :new.col1 := 'AA';
    END IF;
    My aim is if col1 set to NULL or col1 is not included in update statement then value 'AA' should be assigned to col1.
    This works fine in following cases
    1) If UPDATE statement set col1 to NULL explicitly
    2) If :old.col1 is NULL and col1 is not included in update statement
    But not working when
    3) :old.col1 IS NOT NULL and col1 is not included update statement.
    I want value 'AA' should assigned to col1 in case 3 also. Is there any way ?
    Thanks.

    I don't think that this can be done through the trigger alone, because the trigger cannot distinguish between the two cases where ...
    i) col1 is not mentioned in the update, and ...
    ii) col1 is mentioned but is updated from a non-null value to the same value.

  • JBO-25014: Another user has changed + DB Update trigger

    I have an DB update trigger on each row that updates 2 fields of the cuurent row:
    :New.T_SCHEDULE := SYSDATE + interval '+0 1:0:0' day to second;
    :New.STATUS := 30;
    In the Entity I have set Refresh after update/insert to yes for the attributes based on those updated fields.
    Now in a AM service method I change values of other fields through a design time ViewObject row and commit the transaction.
    The second time I activate that service method I get the JBO-25014 exception.
    Adding the following just after the commit statement solves the problem:
    trans.commit(); currentWeventContactListRow.refresh(Row.REFRESH_WITH_DB_FORGET_CHANGES);
    Should the framework not refresh the attributes updated by the trigger because of the parameter Refresh after update/insert set to yes?
    Or didn't I understand the meaning of Refresh after update/insert of an entity attribute?
    Thanks
    Frederic

    That was bug# 3935904, which I filed on behalf of your thread here:
    adf timestamp bug when value documented by db trigger
    That was closed as a duplicate later of bug# 4515623, fixed in Oracle Database 11g
    There are backports of that bug available for various earlier versions of the database. You might check with support to see if that's what you're encountering and whether the patch would remedy your problem.

  • Which field is the workflow trigger for a Contract Agreement ?

    Greeting everyone,
    I am not sure if this has been answer before or if this is the correct forum. If not, apologies in advance and do direct me to the appropriate topic/forum.
    I have an inquiries with regards to Contract Outline agreement and workflow trigger.
    Based on my company configuration, the trigger is based on the changes in value and release strategy.
    What I am unsure is that which field the workflow-trigger checks?
    Does SAP checks the field "Target Value" in contract header, or  the sum of net value in each of the contract items?
    Thank you

    Hello Sek,
    In contracts, the target value is used for the release strategy determination and not the net contract value. If you maintain a target value in the contract header, this value is set in field CEKKO-GNETW to determine the strategy. If no target value exists on header level, a cumulation of the target values of the items is carried out and used for the release strategy determination.
    Regards,
    Mauro

  • How to check which fields of a table are changed

    Hi
    I have a FM in which i pass VBAK and VBAP. I store records of table in internal tables and update the values during execution and at the end of this i have to cpmare VBAK and VBAP with internal tables to chcek which field value is changed in both VBAK and VBAP. Its not possible to check all fields bcause there are so many fields in VBAK and VBAP. Can any body help me.
    Thanks and Regards
    Aditya

    Hi,
    Try using where used list.
    click on the field. pree F1. select Technical Info from the pop-up. then from the field data, double click one the field name. it will navigate to the table/structure where the field is used. double click on the field there or
    press CntrlShiftF3.
    It will give you the where used list.
    Pls reward poins if useful.
    Regards,
    Chandru

  • How to identify the field value has been changed to new value?

    Hi,
    I am adding a custom field through CI include for 171 info type.
    But I need to identify that whenever user enters into change mode and changes the value(Custom field) then I have to populate an error message(i.e Manitain date type in 41.).
    I know we can identify that by change(AEDAT) date of that particular record but I could not identified that particular field has changed or not.
    Please share your experience, if possible send pseudo code.
    <REMOVED BY MODERATOR>
    Thank you,
    Ravi.
    Edited by: Alvaro Tejada Galindo on Feb 6, 2008 12:37 PM

    Can you keep a copy of the record when you enter the infotype and check changes against that?
    Rob

  • Can you identify which MS Update package contains build 34238

    We discovered that a recent update had broken some code and we're trying to pin down which update was the culprit.   We have a fix, so that isn't the issue.   The issue is that the software is being used by clients and we would like to warn them not
    to apply the Microsoft Update until after they have applied our fix.
    What I know is that Build 34209 runs the code with no errors, however machines with build 34238 (.net 4.0.30319.34238) has the issue.    So, if anyone can let us know which update this build is found int, we can warn our customers.
    Thanks
    Stuart Hunt

    Hi Stuart Hunt,
    I do not have any documentation off hand to identify which update package contains MSBuild 34238, however I would like to know is there any relationship with MSBuild? MSBuild is only used to compile applications base on the configurations, will MSBuild version
    effect compile result?
    Besides if you think the .net 4.0.30319.34283 is the issue, you could include some previous version of dll in your project package and use these dll instead of using system dlls.
    Some of my research on the Internet pointed to KB3004394 (Not that sure), I would suggest you to have a check.  But not sure, you may need to get a confirmation from:
    http://answers.microsoft.com/en-us/windows/forum/windows_update?tab=Threads
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Instead of Update Trigger error

    Hi all,
    I've been trying to solve this issue from past 4 to 5 days..I am unable to solve...Can someone please help....
    I hhave a requirement in which I need to update 4 tables from a single form...I created a view which will get the required fields along with the primary keys from all these 4 tables.
    Then I created a Instead of Update trigger as below
    CREATE OR REPLACE TRIGGER "HOMEPAGEVIEW_UPDATE"
    INSTEAD OF UPDATE ON cts_homepageview
    BEGIN
    DECLARE
    vID NUMBER;
    UPDATE cts_hardware_info
    SET STATUS_ID = :NEW.STATUS_ID,
    COMPUTER_NAME = :NEW.COMPUTER_NAME,
    OPERATINGSYSTEM_ID = :NEW.OPERATINGSYSTEM_ID
    where computer_id = :NEW.COMPUTER_ID;
    UPDATE cts_server_administrator
    SET PRIMARY_ADMIN_ID = :NEW.PRIMADMIN_ID,
    SECONDARY_ADMIN_ID = :NEW.SECONDADMIN_ID
    WHERE ID = :NEW.ID;
    UPDATE cts_location_info
    SET BUILDING_ROOM_RACK = :NEW.BUILDING_ROOM_RACK
    WHERE LOCATION_ID = :NEW.LOCATION_ID;
    UPDATE cts_maintenace_info
    SET MAINTENANCE_WINDOW = :NEW.MAINTENANCE_WINDOW
    WHERE MAINTENANCE_ID = :NEW.MAINTENANCE_ID;
    END;
    When I try to update a record, am gettting the following error
    ORA-20505: Error in DML: p_rowid=488, p_alt_rowid=COMPUTER_ID, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    Error Unable to process row of table CTS_HOMEPAGEVIEW.
    OK
    I have already posted this question on the forum, but dint get any replies so trying my luck again....Can someone plzzzzzz help...I searched on ths forum for similar requests...Found one post bt hte solution wasnt given...
    Thanks,
    Shravanthi
    Edited by: user0012 on Apr 29, 2009 9:54 AM

    Hi Varad and Andy,
    Thank you both for your responses first..I was soo tensed since no one replied to my previous post fr 5 days..
    Varad,
    With the change Andy told ('Begin & END'), I tried in SQL Workshop updated computer_name (of cts_hardware_info) data in the view..It updated the data. But from the form, it is still giving the same error.
    Andy,
    Here is my view.. All the table are associated with the cts_hardware_info using computer_id. And using this computer_id I have put all the data together.
    CREATE OR REPLACE FORCE VIEW "CTS_HOMEPAGEVIEW" ("COMPUTER_ID", "COMPUTER_NAME", "STATUS_ID", "DESCRIPTION", "OPERATINGSYSTEM_ID", "ID", "PRIMADMIN_ID", "PRIMARYADMIN_PHONE1", "SECONDADMIN_ID", "SECONDARYADMIN_PHONE1", "LOCATION_ID", "BUILDING_ROOM_RACK", "MAINTENANCE_ID", "MAINTENANCE_WINDOW") AS
    select g.computer_id,g.computer_name,g.status_id,cts_hardware_status.DESCRIPTION,g.operatingsystem_id,g.id,g.PrimAdmin_ID,g.PrimaryAdmin_Phone1,g.SecondAdmin_ID, g.SecondaryAdmin_PHONE1,g.location_id,g.BUILDING_ROOM_RACK,g.MAINTENANCE_ID,g.MAINTENANCE_WINDOW from
    (select e.computer_id,e.computer_name,e.status_id,e.operatingsystem_id,e.id,e.PrimAdmin_ID,e.PrimaryAdmin_Phone1,e.SecondAdmin_ID,e.SecondaryAdmin_PHONE1,
    e.location_id,e.BUILDING_ROOM_RACK,f.MAINTENANCE_ID,f.MAINTENANCE_WINDOW from
    (select c.computer_id,c.computer_name,c.status_id,c.operatingsystem_id,c.id,c.PrimAdmin_ID,c.PrimaryAdmin_Phone1,c.SecondAdmin_ID,c.SecondaryAdmin_PHONE1,
    d.location_id,d.BUILDING_ROOM_RACK from
    (select a.computer_id,a.computer_name,a.status_id,a.operatingsystem_id,b.id,b.PrimAdmin_ID,b.PrimaryAdmin_Phone1,b.SecondAdmin_ID,b.SecondaryAdmin_PHONE1 from
    (select cts_hardware_info.computer_id,cts_hardware_info.computer_name,cts_hardware_info.status_id,operatingsystem_id from cts_hardware_info) a
    left join
    (select cts_server_administrator.id,cts_server_administrator.computer_id,cts_administrator_contacts.ADMIN_id as PrimAdmin_ID,Phone1 as PrimaryAdmin_Phone1,
    (select ADMIN_id from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondAdmin_ID,
    (select Phone1 from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondaryAdmin_PHONE1
    from cts_server_administrator,cts_administrator_contacts where cts_administrator_contacts.admin_id = cts_server_administrator.PRIMARY_ADMIN_ID) b
    on a.computer_id = b.computer_id) c
    left join
    (select location_id,COMPUTER_ID,BUILDING_ROOM_RACK from cts_location_info) d
    on c.computer_id = d.computer_id) e
    left join
    (select MAINTENANCE_ID,COMPUTER_ID,MAINTENANCE_WINDOW from CTS_MAINTENACE_INFO) f
    on e.computer_id = f.computer_id) g left join cts_hardware_status on g.status_id = cts_hardware_status.STATUS_ID

  • Update Trigger and COLUMNS_UPDATED()

    Let me rephrase my question:
    I want to know if there is a faster way (probably using bit operators) to see if COLUMNS_UPDATED() in an update trigger on a table with more than 8 columns contains any column other than 1 specific column I will refer
    to as 'columnToIgnore'. I don't care about which columns are included or if the value has actually changed, only that there are other columns present.
    Original question:
    I have inherited a Sql Server database + schema and corresponding application and I have been tasked with speeding up the batch update of users in the database. After running some profiling I discovered that the reason it was slow is because of an update
    trigger on the users table. I did some “cleaning up” of the trigger and now it runs faster but I still think it could be more efficient. The objective of the trigger is to write to an Audit table any time an update takes place and any column is updated (it
    does not actually matter if the value has changed or not) with the exception of 1 specific column. Now I have the following code in the trigger which I had refactored from something much uglier.
    DECLARE @ColumnsUpdated VARBINARY(100)
    SET @ColumnsUpdated = COLUMNS_UPDATED()
    DECLARE @onlyIgnoreColumnChanged int
    SET @onlyIgnoreColumnChanged = 1
    SET @onlyIgnoreColumnChanged = 1
    IF (EXISTS(SELECT 1
    FROM INFORMATION_SCHEMA.COLUMNS Field
    WHERE TABLE_NAME = 'users'
    AND sys.fn_IsBitSetInBitmask(@ColumnsUpdated, COLUMNPROPERTY(OBJECT_ID('dbo.users'), COLUMN_NAME, 'ColumnID')) <> 0
    AND column_name !='columnToIgnore')) BEGIN
    SET @onlyIgnoreColumnChanged = 0
    END
    Ideally I would change the code to disable the trigger and do the insert myself BUT the code is old Classic ASP ( ie. VBScript with ODBC database connections) so I am not going to change any of the calling code because that would cost too much time and probably
    create more problems than I am solving.
    My proposed fix which I am unsure of how to code in SQL:
    It seems to me that there should be a way to get the proper id or position for the column and see if the column was used in the COLUMNS_UPDATED().
    If it was not used then we can set @onlynieuwchanged to 0 for the remaining code (not shown)
    If it was used then remove the bit from the COLUMNS_UPDATED() and see if it is empty
    If its empty then then we can set @onlynieuwchanged to 1 for the remaining code (not shown)
    If it’s not empty then then we can set @onlynieuwchanged to 0 for the remaining code (not shown)
    My problem is I am not sure how to go about coding this logic in SQL. I would think it would be possible with BIT operators? It would seem this could be more efficient than what I have now as it would get rid of the select statement which could slow down
    a large batch update.
    Notes
    My table has 30+ some columns so more than 8 which is relevant when working with COLUMNS_UPDATED() from what I have read. It also means that testing each column with UPDATE() would probably be more inefficient than what I have now.
    The update is called from the front end code (VBScript) which currently times out although not as much as it used to with my latest change. I cannot alter the code to run async mode and show progress, it would be easier for me to update the trigger.
    Reason for audit - we only record the user id in an audit table. This is then used to force a sync to another system outside of our source control that is used for various other tasks (mailings, views, etc). Again, I do not want to change how this system
    works, I only want to speed up the existing trigger with minimal effort.
    Sql Server version 2012, database Schema is set to Sql server 2005 compatibility mode.
    Any help would be greatly appreciated. Thank you in advance!
    -Igor

    Thank you again everyone for your input. As I mentioned there is much out of my control. This is an active application worked on by many developers and has been pieced together over the past 10+ years. It is NOT well written, the database schema has MUCH
    to be desired, and the code is the classic definition of 'spaghetti' code and multiple platforms are used to access the data, and there are millions of lines of code. There is nothing I can do about all of this which is why I am ignoring much of the advice.
    Sure, if this was a new application or something that was well written and possible to do some modifications then I would BUT it's not. If I was given 1 year of dedicated time to fix everything... well, I would probably throw it all away and start from scratch.
    Here is what I finally came up with. It is probably not  much faster, if at all, but when I started this I thought there would be a simple solution that I did not see. I will probably leave my code the way it was but will include the following for reference.
    DECLARE @bit int, @field int, @char int, @comparisonField VARBINARY(100)
    -- the following segment recreates the value contained in COLUMNS_UPDATED() if only the field nieuw was altered and stores that value in field @comparisonField
    SET @field = (SELECT COLUMNPROPERTY(OBJECT_ID('dbo.users'), 'columnToIgnore', 'ColumnID')) -- geth the field id for column nieuw
    select @bit = (@field - 1 )% 8 + 1
    select @bit = power(2,@bit - 1)
    select @char = ((@field - 1) / 8) + 1
    -- select @field AS [Field number], @char AS [Char], @bit AS [Bit] -- debug code to check the bits that are tested.
    -- Recreate the binary value of just having the field present in the columns_updated
    SELECT @comparisonField = CONVERT(VARBINARY(100),'0x' + RIGHT('000000000000000000' + RIGHT(CONVERT(VARCHAR(30), CONVERT(varbinary(1), @bit), 1), 2), @char*2), 1)
    -- if the generated value in @comparisonField is the same as COLUMNS_UPDATED() then only nieuw was updated
    IF @comparisonField <> COLUMNS_UPDATED() BEGIN
    -- code to add to the tracking table
    END
    -Igor

  • How to Identify Delta Field in DS

    Hi Gurus,
      1. My understanding is if a field in datasource(DS) is
      set as Delta, whenever that field value changes in DS
      then the delta process will initialize. (please correct
      me if i am wrong) Do we need to replicate everytime
      the field value is changed so that the value is updated
      in the data target, if so is there a process to
      automate it...  
      2. Can someone tell me how to identify Delta Field in a
      DS for example in 0FI_AP_4. i tried to search for it in
      help.sap.com but all i could find is that 0FI_AP_4 is
      delta capable but couldn't find which field is set to
      delta...
    Thanks,
    SM

    Sri Mal,
       1. Yes, there should be one field enabled enabled for delta.
       2. no need to replicate every time when ever data changes. we need to replicate when DS changed. i mean not business data, if meta data changes we need to replicate the DS. let us assume you made one field for selection and one field as hide. then  you need to replicate this.
      3. OFI_AP_4 is standard DS. you can't enable delta for this one if SAP didn't provide that. we need to active data for this. in the SAP Documentation you can see whether it is delta capable or not.
    comming to 0FI_AP_4, IT IS DELTA CAPLABLE.
    Hope this helps.
    All the best.
    Regards,
    Nagesh Ganisetti.

  • Update trigger ...problem

    ... i have following requirement for the update of person table
    1) if address field is changed then i want to store old address information in one table and then replace the new address in person table
    2) if fields other than address are changed then just new values get replaced in person table... ne need of storing old values any where...
    how can i do that any idea..

    There are two ways to do it, database triggers or form level triggers.
    For database, u have to create a trigger on the table which will be executed only when the address field is updated, for example,
    CREATE
    TRIGGER <trigger_name>
    BEFORE UPDATE OF <table_column> ON <table_name>
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    BEGIN
    do the right thing.......
    insert into the old value in other table......
    assign new values to the old one.........
    END;
    or u can use the on-, pre- or post update trigger at the form level after checking if the address field is changed and updated. See forms help for Get_item_property built-in Database_value.
    Message was edited by:
    zaibiman

Maybe you are looking for

  • How can you delete old mail addresses?

    When sending an email (with iPhone 4, iOS5, Gmail) and you are starting to type the recipient's name at the "To:" field, the autofill function suggests addresses some of which are dated / no longer valid / unwanted ones, from previous recipients. How

  • I cant purchase storage on icloud, it keeps saying unknown error, why?

    i cant seem to purchase the icloud storage, it keeps saying unknow error occured, why? and i also cannot access icloud from the my laptop it also says unknown error occured, but i can open the website to access it. but why does this happen

  • User "not responding" when trying to audio and video chat

    Hello everyone, I know there have been many posts here about this topic - to be honest I've tried everything and thought starting a clean thread might be the way forward. Basically when I try and do a video (or audio) chat with Australia (or my dad u

  • Can't download adobe flash player 11 cannot contact reliable source

    HELP 911 I am having a problem downloading the Adobe Flash 11 as I get the error (cannot contact reliable source)! I run the file and it stops at 1% and no matter what I do, I cannot run the entire file! I am using Windows 7, 32Bit on a Compaq PC Ple

  • Launch in FullScreen

    Hello, I want to launch my application in FullScreen MODE 1024*768, how to define this parameter, please help me.