2 Replies Latest reply on Jul 11, 2018 12:38 PM by Mike Kutz

    ORA-04084

    Dernbauer

      I created a Trigger on my Laptop

      CREATE OR REPLACE  TRIGGER  "TEST"

         before insert or update or delete on dea

        referencing new as new old as old

         for each row

      declare

      MutatingRow LCM.dea%ROWTYPE;

        begin

          if updating or deleting then

          MutatingRow.name := :old.name;

          insert into dea$hist values mutatingRow;

          end if;

        end;

      insert into dea values ('domi')

        commit;

      delete from dea where name = 'domi'

      select * from dea$hist

      Works perfekt !!!!

       

      When I do the same in Apex

      CREATE OR REPLACE EDITIONABLE TRIGGER  "BDIU_MEMBERS"

         before insert or update or delete on MEMBERS

        referencing new as new old as old

         for each row

      declare

        MutatingRow LCM.MEMBERS$HIST%ROWTYPE;

      begin 

         if :new."ID" is null then

           select to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') into :new.ID from dual;

         end if;

         if inserting then

            :new.row_version_number := nvl(:old.row_version_number,1) + 1;

            :new.created := localtimestamp;

            :new.created_by := nvl(wwv_flow.g_user,user);

            :new.updated := localtimestamp;

            :new.updated_by := nvl(wwv_flow.g_user,user);

         end if;

         if updating then

             MutatingRow.ID := :old.ID;

             MutatingRow.USERNAME := :old.USERNAME;      

             MutatingRow.FULL_NAME := :old.FULL_NAME;

             MutatingRow.EMAIL := :old.EMAIL;

             MutatingRow.PROFILE := :old.PROFILE;

             MutatingRow.PHOTO_FILENAME := :old.PHOTO_FILENAME;

             MutatingRow.PHOTO_BLOB := :old.PHOTO_BLOB;

             MutatingRow.PHOTO_MIMETYPE := :old.PHOTO_MIMETYPE;

             MutatingRow.PHOTO_LAST_UPDATED := :old.PHOTO_LAST_UPDATED;

             MutatingRow.TZ_PREFERENCE := :old.TZ_PREFERENCE;

             MutatingRow.ROW_VERSION_NUMBER := :old.ROW_VERSION_NUMBER;

             MutatingRow.CREATED := :old.CREATED;

             MutatingRow.CREATED_BY := :old.CREATED_BY;

             MutatingRow.UPDATED := :old.UPDATED;

             MutatingRow.UPDATED_BY := :old.UPDATED_BY;

             MutatingRow.MUDATED := localtimestamp;

             MutatingRow.MUDATED_BY := nvl(wwv_flow.g_user,user);

             MutatingRow.MUDATING_ACTION := 'updated';

             Insert into MEMBERS$HIST values MutatingRow;

         end if;

         IF deleting

         then

            MutatingRow.ID := :old.ID;

            MutatingRow.USERNAME := :old.USERNAME;      

            MutatingRow.FULL_NAME := :old.FULL_NAME;

            MutatingRow.EMAIL := :old.EMAIL;

            MutatingRow.PROFILE := :old.PROFILE;

            MutatingRow.PHOTO_FILENAME := :old.PHOTO_FILENAME;

            MutatingRow.PHOTO_BLOB := :old.PHOTO_BLOB;

            MutatingRow.PHOTO_MIMETYPE := :old.PHOTO_MIMETYPE;

            MutatingRow.PHOTO_LAST_UPDATED := :old.PHOTO_LAST_UPDATED;

            MutatingRow.TZ_PREFERENCE := :old.TZ_PREFERENCE;

            MutatingRow.ROW_VERSION_NUMBER := :old.ROW_VERSION_NUMBER;

            MutatingRow.CREATED := :old.CREATED;

            MutatingRow.CREATED_BY := :old.CREATED_BY;

            MutatingRow.UPDATED := :old.UPDATED;

            MutatingRow.UPDATED_BY := :old.UPDATED_BY;

            MutatingRow.MUDATED := localtimestamp;

            MutatingRow.MUDATED_BY := nvl(wwv_flow.g_user,user);

            MutatingRow.MUDATING_ACTION := 'deleted';

            Insert into MEMBERS$HIST values MutatingRow;

         end if;

      end ;

       

      I got

           ORA-04084: NEW-Werte für diesen Triggertyp können nicht geändert werden

      • ORA-04084: NEW-Werte für diesen Triggertyp können nicht geändert werden ORA-06512: in "LCM.BDIU_MEMBERS", Zeile 5 ORA-04088: Fehler bei der Ausführung von Trigger 'LCM.BDIU_MEMBERS'

      Any Ideas ??

       

      Thank you.