Update trigger (the table_name is mutation)

Hi refugees,

Can someone help me solve my problem.

---------

create table XE_TEST (number SAL, UPDATED_FLAG varchar2 (1));

Insert into XE_TEST values(5000,'Y');

Select * from XE_TEST;

create the table XE_TEST1 select * from XE_TEST;

----------


CREATE OR REPLACE TRIGGER XE_UPDATE_TRG
AFTER UPDATE ON XE_TEST
FOR EACH LINE
DECLARE
BEGIN
IF (: NEW.) UPDATED_FLAG = 'Y') then
Update XE_TEST1 set SAL =: NEW. SAL;
end if;

Update XE_TEST set UPDATED_FLAG = 'n';

EXCEPTION
WHILE OTHERS
THEN
raise_application_error (-20100, SQLERRM);
END;
/



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

Update XE_TEST set sal = 4000;

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

* I had the error of Toad *.
(ORA-20100: ORA-04091: table SYSTEM1.) XE_TEST is changing, function of triggering/can not see
ORA-06512: at the 'SYSTEM1 '. XE_UPDATE_TRG', line 12
ORA-04088: error during execution of trigger ' SYSTEM1. XE_UPDATE_TRG') while I run the Update statement.

How can I write the trigger to change the value of UPDATED_FLAG field in the "n" and update the value in the XE_TEST table.
SQL> create table XE_TEST(SAL number,UPDATED_FLAG varchar2(1));

Table created.

SQL> Insert into XE_TEST values(5000,'Y');

1 row created.

SQL> select * from XE_TEST;

       SAL U
---------- -
      5000 Y

SQL> create table XE_TEST1 as select * from XE_TEST;

Table created.

SQL> select  *
  2    from  xe_test
  3  /

       SAL U
---------- -
      5000 Y

SQL> select  *
  2    from  xe_test1
  3  /

       SAL U
---------- -
      5000 Y

SQL> CREATE OR REPLACE
  2    TRIGGER XE_UPDATE_TRG
  3    BEFORE UPDATE
  4    ON XE_TEST
  5    FOR EACH ROW
  6    DECLARE
  7    BEGIN
  8        IF :NEW.UPDATED_FLAG = 'Y'
  9          then
 10            update XE_TEST1 set SAL =:NEW.SAL;
 11        end if;
 12        :NEW.UPDATED_FLAG := 'N';
 13  END;
 14  /

Trigger created.

SQL> Update XE_TEST set sal=4000;

1 row updated.

SQL> select  *
  2    from  xe_test
  3  /

       SAL U
---------- -
      4000 N

SQL> select  *
  2    from  xe_test1
  3  /

       SAL U
---------- -
      4000 Y

SQL> 

SY.

Tags: Database

Similar Questions

  • Table is the mutation of error in after the update trigger

    Hello

    In all of my table, I have columns EDITDATE and EDITUSER. So whenever a table is updated I need to update these two fields with the USER and SYSDATE. For this I use a BEFORE UPDATE trigger. This trigger is activated, but I get "ORA-04091: table %s.%s is changing, function of triggering/can not see" error every time I update the table. I used this method in SQL Server. I understand that Oracle doesn't have to be the same as SQL Server but I do not know there is a way to do this. Do you know what it is?

    EDIT: Here is the Code of the trigger

    create or replace
    TR_LEGISLATION_CALCUL_AE RELAXATION
    BEFORE THE UPDATE
    ON LEGISLATION_CALCUL
    FOR EACH LINE
    DECLARE
    v_LEGISLATIONCALCULID NUMBER (10,0);

    BEGIN
    SELECT: NEW. LEGISLATIONCALCULID

    IN v_LEGISLATIONCALCULID
    FROM DUAL;
    UPDATE LEGISLATION_CALCUL
    SET EDITUSER_ID = UID,
    EDITDATE = SYSDATE
    WHERE LEGISLATIONCALCULID = v_LEGISLATIONCALCULID;
    END;

    Published by: Mikhail on 12 March 2012 23:54

    Mikhail says:
    Hello

    In all of my table, I have columns EDITDATE and EDITUSER. So whenever a table is updated I need to update these two fields with the USER and SYSDATE. For this I use the AFTER UPDATE trigger. This trigger is activated, but I get "ORA-04091: table %s.%s is changing, function of triggering/can not see" error every time I update the table. I used this method in SQL Server. I understand that Oracle doesn't have to be the same as SQL Server but I do not know there is a way to do this. Do you know what it is?

    EDIT: Here is the Code of the trigger

    create or replace
    TR_LEGISLATION_CALCUL_AE RELAXATION
    BEFORE THE UPDATE
    ON LEGISLATION_CALCUL
    FOR EACH LINE

    just put this in your before update (and not after the update as you mentioned) for each trigger line:

    BEGIN
    
    :new.EDITUSER_ID := UID;
    :new.EDITDATE := SYSDATE;
    
    END;
    
  • Global Temp table to overcome the problem of mutation Trigger

    Hi all. I need to remove a line in a table and thought that I would get around the issue of trigger mutation creating a GTB table. I created 2 different triggers. One is a level line, the other trigger a statement-level trigger.
    The first trigger collects the information required to identify the row I want to delete. It is:
    CREATE OR REPLACE TRIGGER Requisition_Capture
    AFTER UPDATE OF Delivery_Code on Supply_Items
    FOR EACH ROW
    BEGIN
    
      IF :NEW.Delivery_Code = '#' THEN
        INSERT INTO Requisition_Storage
          (Req_Code)
        VALUES
          (:NEW.Requisition_Code);
      END IF;
    END;
    And the second trigger deletes the line:
    CREATE OR REPLACE TRIGGER SUPPLY_ITEM_RESET
    AFTER INSERT ON Requisition_Storage
    
    DECLARE
    
    BEGIN
    
      DELETE FROM Supply_Items r
       WHERE r.Requisition_Code =
             (SELECT t.Req_Code
                FROM Requisition_Storage t, Supply_Items s
               WHERE t.Req_Code = s.Requisition_Code)
         AND r.Order_Qty = 0;
    
    END;
    The GTB's stores following the information that I need to remove the line. :
    -- Create table
    create global temporary table REQUISITION_STORAGE
    (
      req_code VARCHAR2(20)
    )
    on commit delete rows;
    When the Delivery_Code column is updated in the Supply_Item table and the value is reset to ' # ', that I want to capture the Requisition_Code in the Building, so I can run the statement-level trigger and remove the reset line. However, I still have a problem of error mutation. What Miss me?

    The statement-level trigger would need to be a Supply_Items AFTER UPDATE TO for this to work around the problem of trigger mutation. You must ensure that your UPDATE has finished update all rows to be updated before your statement-level trigger executes.

    As has been pointed out, however, the willingness to work around a trigger mutation error almost always indicates that you have a problem of data model. And you are almost always better served by setting the data model to work around the error.

    Justin

  • How to create the update trigger

    Hi all

    I want to create the trigger
    After the update of the

    How can I create

    I want to update my custom table "xx-per_all_vacancies.

    This trigger should be executed when
    table of hr_api_transaction update

    Hello

    It will not work

    >
    Select transaction_id INTO update_trans_id from hr_api_transactions where: NEW. LAST_UPDATE_DATE DISLIKES: NEW. CREATION_DATE;
    xx_GL_Vacancies.update_transaction (update_trans_id);

    >

    Implement

       select transaction_id INTO update_trans_id from hr_api_transactions where LAST_UPDATE_DATE NOT LIKE :NEW.CREATION_DATE;
       xx_GL_Vacancies.update_transaction(update_trans_id);
    

    This might give you an error of mutation.

    see you soon

    VT

  • Present the version 7.0.1 download available for 8.0.1. Trigger the update begins a charge down and ending. Download and then 'connect to update server' that never connects. This has happened over a period of 2 weeks.

    My 7.0.1 program tells me there's an update available, 8.0.1...
    I trigger the update that downloads an installation program.
    When I restart firefox to get the update installed, restart and triggers a new window indicating that it contacts the server to update. This will continue to get in touch for 30 minutes with no established connection.
    To keep my browser to 7.0.1.

    Windows Vista Ultimate sp2 64-bit.

    Try the alternative and more simple way to download from here and simply run

  • BEFORE the UPDATE trigger between field in both tables

    Hi Oracle Experts,

    I'm a newbie in the triggers. I want to do a trigger that fires whenever changes are made to a table, updates a field in the second table. The details are as below:

     SAMPLE (
    SAMPLEID    NUMBER(10,0)
    ACTIVITYID     NUMBER(10,0)
    ACTIVITYTABLEID     VARCHAR2(20 BYTE)
    SAMPLEDT     DATE
    SAMPLEPTID     VARCHAR2(20 BYTE)
    SAMPLENOTIFY     VARCHAR(1 BYTE)
    )
    

    SAMPLE_RESULT(
    SAMPLEID     NUMBER(10,0)
    TESTID     VARCHAR2(20 BYTE)
    PROPERTYID     VARCHAR2(20 BYTE)
    TESTERID     VARCHAR2(20 BYTE)
    ENTRYDT     DATE
    RESULTNUM     NUMBER(18,8)
    RESULT     VARCHAR2(20 BYTE)
    RESULTTYPE     VARCHAR(1 BYTE)
    RESULTSTATUS     VARCHAR2(1 BYTE)
    )
    

    The idea of relaxation:

    CREATE OR REPLACE
    TRIGGER "DBA".AUTO_NOTIFY
    BEFORE UPDATE OF RESULT ON SAMPLE_RESULT
    FOR EACH ROW
    WHEN (NEW.PROPERTYID = 'Action Taken')
    BEGIN
    
    //my idea
    :new.sample.samplenotify = 'S'
    
    //but i don't know how to make a reference to another table
    
    END;
    

    The trigger will fire every time the propertyid is pronounced, it sets the value of samplenotify in the example in table for the of '.

    Is this possible?

    Thank you in advance.

    La: new.column_name syntax applies only to the table that the trigger is on.  You will need to use an update on the other table.

    CREATE OR REPLACE TRIGGER auto_notify

    BEFORE the UPDATE result WE sample_result

    FOR EACH LINE

    WHEN (NEW. PROPERTYID = "Taken Action")

    BEGIN

    Example of UPDATE

    SET s = samplenotify"

    WHERE sampleid =: NEW.sampleid;

    END auto_notify;

    /

  • Best way to trigger the update of TreeItem?

    I have a TreeView which consists of thumbnails - those responsible at the request and in the meantime, just text is displayed.

    I however have TreeView problems to recognize when such an element is updated. Initially I tried this, calling setValue on the TreeItem element that is appropriate:
             private void updateItem(MediaItem item) {
          TreeItem<MediaItem> foundItem = findMediaItem(treeRoot, item);
          
          if(foundItem != null) {
            foundItem.setValue(item);
          }
        }
    
        private TreeItem<MediaItem> findMediaItem(TreeItem<MediaItem> treeRoot, MediaItem mediaItem) {
          for(TreeItem<MediaItem> treeItem : treeRoot.getChildren()) {
            if(treeItem.getValue().equals(mediaItem)) {
              return treeItem;
            }
            
            if(!treeItem.isLeaf()) {
              TreeItem<MediaItem> foundItem = findMediaItem(treeItem, mediaItem);
              
              if(foundItem != null) {
                return foundItem;
              }
            }
          }
          
          return null;
        }
    Unfortunately, I couldn't get this to work at all. After a few more tries, I found a way that works, but it is very heavy:
     private void updateItem(MediaItem item) {
          TreeItem<MediaItem> foundItem = findMediaItem(treeRoot, item);
          
          if(foundItem != null) {
            int index = foundItem.getParent().getChildren().indexOf(foundItem);
            
            foundItem.getParent().getChildren().set(index, new TreeItem<MediaItem>(item));
    //        foundItem.setValue(item);
          }
        }
    Having to create a new object TreeItem and looking for the index of the former just if I can replace it in the ObservableList of its parent seem exaggerated. I was more looking for a method simple "updateTreeItem" or something, where I can move to the item that has been updated. The API TreeCell doesn't seem to have this method, but I donot see how I can use it.

    Note: the element 'nine', I update here is actually the same instance (in other words, it is equal to the previous one) - I want to only trigger a new drawing, her look has changed even if it is always equal. I have not tried the substitution of equals for her, but even if it works it would be unsatisfactory because, from an application perspective, these two items are equal apart from having a miniature finished loading...

    A simpler solution?

    Published by: john16384 on December 4, 2011 19:40

    I'd come to it from a different angle (but this is not to say that there nothing wrong with your approach in theory however).

    See if this helps you:

    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.concurrent.Task;
    import javafx.concurrent.Worker;
    import javafx.scene.Scene;
    import javafx.scene.control.ProgressIndicator;
    import javafx.scene.control.TreeCell;
    import javafx.scene.control.TreeItem;
    import javafx.scene.control.TreeView;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    
    import java.net.URL;
    
    public class TestApp extends Application
    {
        public static void main(String[] args) throws Exception
        {
            launch(args);
        }
    
        public void start(final Stage stage) throws Exception
        {
            BorderPane root = new BorderPane();
    
            TreeView tree = new TreeView();
    
            TreeItem bears = new TreeItem(new Animal("Bears", null));
            bears.getChildren().addAll(
                    new TreeItem(new Animal("Asiatic Black Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/asiaticblackbear.png"))),
                    new TreeItem(new Animal("Black Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/blackbear.png"))),
                    new TreeItem(new Animal("Brown Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/brownbear.png"))),
                    new TreeItem(new Animal("Panda Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/panda.png"))),
                    new TreeItem(new Animal("Polar Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/polar.png"))),
                    new TreeItem(new Animal("Sloth Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/sloth.png"))),
                    new TreeItem(new Animal("Spectacled Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/spectacled.png"))),
                    new TreeItem(new Animal("Sun Bear", new URL("http://d38kpozl2gihos.cloudfront.net/wp-content/themes/gbf/images/sunbear.png"))),
                    new TreeItem(new Animal("Pooh Bear", new URL("http://images3.wikia.nocookie.net/__cb20101111001913/disney/images/f/fe/84108-pooh_bear.jpg")))
            );
    
            tree.setRoot(bears);
    
            tree.setCellFactory(new Callback, TreeCell>()
            {
                public TreeCell call(TreeView tree)
                {
                    return new AnimalTreeCell();
                }
            });
            root.setCenter(tree);
    
            Scene scene = new Scene(root, 800, 600);
            stage.setScene(scene);
            stage.show();
        }
    
        //-------------------------------------------------------------------------
    
        private class AnimalTreeCell extends TreeCell
        {
            private Task loadTask;
    
            protected void updateItem(Animal animal, boolean empty)
            {
                super.updateItem(animal, empty);
                if (!empty && animal != null)
                {
                    setText(animal.getName());
                    if (animal.getPhotoUrl() != null)
                    {
                        loadPhoto(animal.getPhotoUrl());
                    }
                }
            }
    
            protected void loadPhoto(final URL photoUrl)
            {
                if (loadTask != null)
                {
                    loadTask.cancel();
                }
    
                loadTask = new Task()
                {
                    protected Image call() throws Exception
                    {
                        return new Image(photoUrl.openStream());
                    }
                };
    
                setGraphic(new ProgressIndicator());
                loadTask.stateProperty().addListener(new ChangeListener()
                {
                    public void changed(ObservableValue source, Worker.State oldState, Worker.State newState)
                    {
                        if (newState.equals(Worker.State.SUCCEEDED))
                        {
                            // probably should reuse the image view, rather than create a new one each time
                            ImageView imageView = new ImageView(loadTask.getValue());
                            imageView.setFitHeight(40D);
                            imageView.setFitWidth(50D);
                            setGraphic(imageView);
                        }
                    }
                });
    
                new Thread(loadTask).start();
            }
        }
    
        //-------------------------------------------------------------------------
    
        private class Animal
        {
            private String name;
            private URL photoUrl;
    
            private Animal(String name, URL photoUrl)
            {
                this.name = name;
                this.photoUrl = photoUrl;
            }
    
            public String getName()
            {
                return name;
            }
    
            public URL getPhotoUrl()
            {
                return photoUrl;
            }
        }
    }
    

    PS how cool are the sloth bear!

  • After the update trigger

    I'm updating of certain rows in a table from front end applications...

    If I update a particular Null line... then the other value in the column is to replace assets

    Can I write an update trigger after for this

    Can we use if like else statements in triggers

    If a is null, then b is active
  • Update trigger that inserts the record in another table

    I searched the forum and the web for an example like this and I can not find a:

    A field is updated in the TABLE_A and it triggers a single record TABLE_B insert that has the old and the new value of the field.

    I write a lot of complex data warehouse SQL-based reports, but very rarely do much PL/SQL, any help would be appreciated.
    Thanks in advance.

    Hello

    You can specify that the trigger should fire only when certain columns are referenced, like this:

    create or replace trigger test_fund_trig
    before update OF FUNDING
    on table_a
    ...
    

    If you do this, the trigger will not draw on statements such as:

    UPDATE  table_a
    SET     mod_date = SYSDATE;
    

    You should always use an IF statement, as I mentioned earlier, if you do not want to follow the updates where the value of this column has not really changed.

  • I don't get updates for the retina of my macbook pro 15 mid 2015 2.5 processors 16 g ram, last updated, I got was garage to April 8, may be there is no more updates at this time, but what made me think twice this app a player have updated when trigger

    I don't get updates for the retina of my macbook pro 15 mid 2015 2.5 processors 16 g ram, last updated, I got was garage to April 8, may be there is no more updates at this time, but what made me think twice as more than one reader app have update to search for the app store When news, nothing happened and onedrive will not be updated, and this dose of update does not appear in the section updates in the app store app

    any body can help?

    That's what I have in the last few weeks

    Make sure you have a good WiFi connection and are signed in iCloud / App Store

  • Creating a trigger to insert delete update with the sequence number

    Hey all,.
    I have two tables. tbl_main, tbl_temp. Whenever a record is inserted, deleted, updated in tbl_main, I need to insert the records in tbl_temp. All field/column names are exactly the same, except that in tbl_temp, I now have a single column by using a sequence number, a column to determine if the record has been updated, remove, modified(hence the codes) and the date when a record has been added to the table.
    So far, that's what I have:

    create or replace
    audit_trg relaxation
    after update or insert or delete ON tbl_main
    for each line
    Start
    If the update can
    insert into tbl_temp (seq_id, idx, ctl, action_taken, date_added)
    VALUES
    (temp_seq.nextval, idx, mke, ctl, sysdate, 'U');
    ELSif INSERTION then
    insert into tbl_temp (seq_id, idx, ctl, action_taken, date_added)
    VALUES (temp_seq.nextval, idx, mke, ctl, 'n', sysdate);
    ELSIF deletion then
    insert into tbl_temp (seq_id, idx, ctl, action_taken, date_added)
    VALUES (temp_seq.nextval, idx, mke, ctl, would be ', sysdate);
    END IF;
    END audit_trg;

    I tried several combinations, but I get many compilation errors. This code looks good or I am the way of track? Thanks in advance.

    Who looks fine for me. What are the mistakes are you?

    Assuming that MKE and CTL are columns in the base table, your INSERT statements will insert either the: new.mke and: new.ctl values or the: old.mke and: old.ctl values in the table. Presumably, you could insert the: new values for inserts and updates, and the: old values for deletions.

    Justin

    Published by: Justin Cave 27 February 2009 16:08

    DOH! Just noticed the error...

  • error trigger table to strange mutation...

    I don't think I should receive a trigger for changing table error...
    As my trigger code is just acessnig value from another table... using a function.
    When I change my status from open to qualified... this trigger is enabled and fails with the error table to trigger the mutation...
    The trigger table mutation should only occur when you query on the same table... The table here are different... so I don't think
    trigger of table mutation should shoot...
    Here is the code of the trigger
    create or replace
    TRIGGER "CHESS".leads_after_update
    before the update
    ON lead
    FOR EACH LINE

    DECLARE
    v_username varchar2 (10);
    Number MNO;

    BEGIN

    -Find user name of the person performing the UPDATE in the table



    -Insert record into the audit table

    MNO: = 0;
    IF: OLD. PRODUCT_tYPE = 'PTSUBSCRIBER' and: new.lead_status = "QUALIFIED" then

    -update contact contactType set = 'SUBSCRIBER' where contact_no =: old.contact_nO;
    -commit;
    -INSERT IN CONTACT_tRANSACTION
    -(TRANSACTION, CONTACT_NO, SALESMAN_cODE, ADATE)
    -VALUES
    -(: old.contact_nO, 'PROSPECTIVE QUALIFIED SUBSCRIBER', SYSDATE,: NEW.) EMPCODE_up);

    UPDATE EMP SET MGR = find_qsubt() WHERE LEAD_NO =: NEW. LEAD_NO and mag_no = mid().
    ON THE OTHER
    IF: OLD. PRODUCT_tYPE = 'PTSUBSCRIBER' and: new.lead_status = "UNQUALIFIED" then

    update contact set contactType = 'DISQSUBSCRIBER' where contact_no =: old.contact_nO;

    UPDATE EMP SET MGR = find_uqsubt() WHERE LEAD_NO =: NEW. LEAD_NO and mag_no = mid().
    END IF;


    END IF;



    IF: OLD. PRODUCT_TYPE = 'PTADVERTISER' AND: NEW. LEAD_STATUS = "QUALIFIED" then
    -INSERTION IN MY VALUES ('ENTER DRAGONADV");
    update contact contactType set = 'ADVERTISER', FLAGS = 'Y' where contact_no =: old.contact_nO;
    INSERT INTO CONTACT_tRANSACTION
    (CONTACT_NO, TRANSACTION, TDATE, SALESMAN_cODE)
    VALUES
    (: old.contact_nO, 'PROSPECTIVE ADVERTISER QUALIFIED', SYSDATE,: NEW.) EMPCODE_up);

    UPDATE EMP SET MGR = find_qadvt() WHERE LEAD_NO =: NEW. LEAD_NO;
    ON THE OTHER
    IF: OLD. PRODUCT_TYPE = 'PTADVERTISER' AND: NEW. LEAD_STATUS = "UNQUALIFIED" then
    -INSERTION IN MY VALUES ('ENTER DRAGONADV");
    update contact set contactType = 'DISQADVERTISER' where contact_no =: old.contact_nO;

    UPDATE EMP SET MGR = find_uqadvt() WHERE LEAD_NO =: NEW. LEAD_NO;



    END IF;
    END IF;


    END;

    This is the error message...
    ORA-20505: DML error: p_rowid = 535, p_alt_rowid = LEAD_NO, p_rowid2 =, p_alt_rowid2 is. ORA-04091: table of CHESS. EMP is changing, the trigger/function cannot see ORA-06512: at "CHESS. FIND_QSUBT', line 6 ORA-06512: at "CHESS. LEADS_AFTER_UPDATE', line 23 ORA-04088: error during execution of trigger ' FAILURES. LEADS_AFTER_UPDATE'
    Error failed to process row of table DRIVE.
    Ok






    Function...
    create or replace
    function
    Find_qadvt return number is
    mmgrno number (10);
    mempno emp.empno%type;
    Start
    Select mmgrno from emp where mgr = 40 and mag_no = mid() empno;
    Select mempno from emp where mgr = mmgrno empno and ename = "QUALIFIED";
    Return mempno;
    end;

    Can someone guide what I'm doing wrong... The emp table is either referenced... too... So I don't think there should be a trigger of table mutation...


    Any guidance will be appreciated

    Published by: susf on July 9, 2012 01:46

    Well, you try to read EMP in the middle of an update of the EMP...

  • After that insert update trigger does not work properly

    Hello experts!

    I created an insert/update trigger after and what strikes me is that it does not work as expected.
    The trigger starts a procedure that performs an insert in a second case of changing values table triggered table ("my_table").

    The problem is that in my second table values, which are correlated to the "my_table", are not changed by the correct values immediately. The trails of the trigger and insert!

    I need to update two times to values appear in my second table. Then only the data of the first update will be inserted in the second recital to table the table parent ("my_table") held the most recent values.

    Do you have an idea what could be the problem?
    create or replace
    trigger myscheme.after_update_insert_set_tw
     after update or insert
      on myscheme.my_table
      for each row
      
    declare 
    
    begin
    
     pr_my_table_tw_sync_sk(:new.lng_falle, :new.int_fallennummer, :new.lng_schaedling, :new.objectid);
    
    
    end;
    Brgds,

    SEB

    Remove the pragma autonomous_transaction and validation of your relaxation. This might be the reason. The transaction autonoumous cant properly consider the values of the current transaction (which is not engaged yet).

    This is not logically (if the upgrade fails or is rolled at the time you do not want the inserted row).

    If you then get a problem because the mutation of tables, you will need a different solution: an autonoumous transaction is not the right solution to workaround.

  • update change the date with sysdate column

    Hello
    I want to add a new column, modify_date, to an existing table.

    This column must have sysdate when ever a record is updated.

    Please let me know the best way to do this same thing.

    Trigger? I think that some problem of mutation?

    Thanks and greetings

    Use a before update trigger and set the: new.modify_date such as SYSDATE.

    SQL> create table t(no number, last_updated date)
      2  /
    
    Table created.
    
    SQL> insert into t values(1,'')
      2  /
    
    1 row created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> edit
    Wrote file afiedt.buf
    
      1  create or replace trigger t_trig before update on t for each row
      2  begin
      3     :new.last_updated := sysdate;
      4* end;
    SQL> /
    
    Trigger created.
    
    SQL> update t set no = 2 where no = 1
      2  /
    
    1 row updated.
    
    SQL> select * from t
      2  /
    
            NO LAST_UPDA
    ---------- ---------
             2 04-DEC-08
    
  • Update trigger problem

    CREATE OR REPLACE TRIGGER zagon_obvestila AFTER UPDATE OF STATUS ON ZKET_OBVESTILA
    
    
    
    FOR EACH ROW
    
    
    
    WHEN (OLD.STATUS = 0 and NEW.STATUS = 1)
    
    
    DECLARE JobSt VARCHAR2(4000);
    
    
    BEGIN
    
    
    
    job_obvestila(SYSDATE, 'TRUNC(SYSDATE+(2/24/60),''MI'')', JobSt);
    
    UPDATE ZKET_OBVESTILA SET JOB_ID = 2130 WHERE IID_OBVESTILA = 1;  
    
    
    
    END;
    
    
    
    / 
    Is it possible to run the update in the outbreak of the same table where the trigger is executed? Update is not running.

    THX

    Published by: senza on 24.9.2008 08:39

    Rethink your business logic or do that: http://asktom.oracle.com/tkyte/Mutate/.

    It is quite debate in the oracle community should use triggers or not. I personally like more, I use that for really, really simple things.

    See here: http://www.oracle.com/technology/oramag/oracle/08-sep/o58asktom.html

Maybe you are looking for