Mutating Error problem using audit trigger for UPDATE

I need to add 4 columns to all of my tables named:
INSERT_BY
INSERT_DATA
UPDATE_BY
UPDATE_DATE
I intend these to act as "inserted" and "last updated" audit trails within the table, as opposed to creating a new table and storing the audit information there. The insert columns appear to be easy, as I can just use a DEFAULT clause within the definition of the table. However when I attempted to write a (my first) trigger then I run into problems with mutating tables. Presumebly because I am attempting to change the table while the trigger is referencing it.
create or replace trigger test_audit
after update on dictionary
begin
update dictionary
set update_by = user, update_date = sysdate
where entity_id = :old.entity_id;
end;
I thought I could maybe get around this by calling a procedure from inside the trigger. Something like:
create or replace procedure test_audit(vColumn in varchar2, vData in varchar2, vTable in varchar2) is
-- vTable is table name
-- vColumn is PK of table
-- vData is value of PK in current row
begin
update vTable
set update_by = user, update_date = sysdate
where vColumn = vData;
commit;
end test_audit;
However I cannot use variable for table names. Will this mean I have to create a procedure for each table/trigger? Is there a way to reference the table name as a variable and keep this a generic procedure? Or is there an easier way to record the auditing UPDATE information for each changed row within the original table?
Many thanks in advance......

Will
this mean I have to create a procedure for each
table/trigger? I think you've answered that question already.
Is there a way to reference the table
name as a variable and keep this a generic procedure?Not that I'm aware of.
Or is there an easier way to record the auditing
UPDATE information for each changed row within the
original table?Well, there's the AUDIT feature.
C.

Similar Messages

  • Mac OS X 10.6.8, receiving error message "Failed to check for updates. The operation couldn't be completed. Operation not permitted." How to fix?

    When I try to update my software, I'm receiving the error message "Failed to check for updates. The operation couldn't be completed. Operation not permitted."
    I'm using Safari 4.0.3. Yes, I know this is an old version of Safari - I can't update it, or any other software on my MacBook. Should I just wait for the Lion OS, or is there any kind of fix a non-technical Mac user like me can attempt without screwing up her laptop?
    I've tried clearing my cache and resetting Safari already - doesn't help. I've also tried to update after disabling my (Norton) antivirus software, thinking that might be interfering. None of these help.
    I don't know if it's a related problem, but also I can't download .pdf files from the internet, although I used to be able to.

    You should use the NortonAV uninstaller to uninstall it. Disabling the dreadful thing in the past hasn't always been sufficient for it to cease creating system havoc. The Mac NortonAV version has a long and well-earned reputation for doing truly seriously nasty things to OS X. Shame on Comcast for inflicting NortonAV on its Mac customers. It's not a matter of if NortonAV will mess up OS X but when and how badly. I can't help but wondering if some setting in your Norton AV has decided that NortonAV, rather than you, will be making executive decisions about what you are allowed to install on your computer and is keeping that fact a secret.
    After you are done uninstalling Norton use the finder to search for any Norton files that the uninstaller might have missed. Add the option to search for invisible files.
    After you have removed all the Norton bits and pieces restart in safe mode by holding down the shift key right after the startup chime. Keep holding down the shift key until you see the Apple logo and spinning gear. Safe mode does some maintenance tasks which means a much longer than normal startup time. Use Disk Utility to repair permission
    If your Mac works normally in safe mode restart. If things still aren't fixed you might want to give another shot at reinstalling Snow Leopard from the install DVD and applying the Mac OS X 10.6.8 Update Combo before taking your Mac to the Apple Store.
    If you feel the need to run AV software on your Mac use ClamXav in manual mode. It's donationware and doesn't seem to cause the litany of weird problems that are associated with other AV software.

  • "FRM-40501: Oracle error: Unable to Reserve Record For Update or Delete"

    "FRM-40501: Oracle error: Unable to Reserve Record For Update or Delete"
    as I can unblock a session in the graphical surroundings of administration of the BD 10g of Oracle

    From experience with this problem since the blocked customer form has been coded not to wait for the updating session to complete then there is likely no waiter on the system now so you cannot find the blocking session.
    What you need to do is determine what row the Form was going after then using SQLPlus issue an update on the row. If the blocking session has not yet committed then this update will wait. Now if you look for blocking sessions you will be able to find it and make a determination if the session should be killed or if someone needs to call the user and ask he or she to flip through their screens and get out of the blocking screen.
    Applications screens written not to wait on currently being updated data need to also be written to expose the information necessary to identify the row(s) in question.
    HTH -- Mark D Powell --

  • FRM-40501 ORACLE error: unable to reserve record for update or delete when

    Hello.
    I have two tab pages and one item on each page. Second tab page item, is mirror item of the first one. I use synchronize property on the mirrored one.
    When i try to update mirrored one i get that error: FRM-40501 ORACLE error: unable to reserve record for update or delete when.
    How can i solve that?
    Thanks

    hi dejan,
    the error u r getting means that the record cannot be locked. This is ussually caused if u had locked the record from somewhere else (u or another user) or when forms cannot find corresponding column to the base table to lock the record.. U probably r facing the second situation. I'm not sure that forms can commit a change to an item that is synchronized cause synchronized items ignore their base table attribute and just copy their value from the other item.
    Why don't u try Copy Value from Item property using <block_name>.<item_name> syntax and your item will have a value copied from the other item but u will have no problem with the db transactions. I suppose..
    hope this helps,
    teo

  • Can I use cellular data for updating ios 7.0.2 to 7.0.4 in iPhone 5

    Can I use cellular data for updating ios 7.0.2 to 7.0.4 in iPhone 5.  I just want to know coz i only have 3G cellular data ....

    No.

  • Ios 5.1 OTA update gives error message ( unable to check for update - an error occured while checking for a sofware update ), can anyone help ?

    i am trying to download the latest ios 5.1 but the OTA update gives me a error message ( unable to check for update - an error occured while checking for a sofware update )
    the same thing happens in my ipad too.

    Thank you! I've been trying all day to get this to work! and finally i found the answer!
    amensistech wrote:
    I found a fix for this.
    Go to Wifi    Settings and then select your Wifi Network. Tap the blue arrow to go into Wifi settings and then select the DNS tab.
    Set the DNS to 8.8.8.8 and then go back to the software update page.
    This time it shall work.
    I tried it on an iPad 1 running iOS 5.0.1 but I am sure this shall help.
    Do rate me and reply if it works.

  • HT4623 Trying to update IPad to iOS 6. . . but get error message "Unable to check for update - An error occurred while checking for a software update

    I am trying to update my IPad 2 to the new iOS 6. . .but when I check ofr updates, I get an error message "Unable to check for update - An error occurred while chekcing for a sofware update"  .
    I have powered off and tried again . . .but it still cannot .  My Wifi is fine - and the IPad is plugged in.
    Are other people having these issues.
    I tried to log onto Apple support and got an DNS error message. . .
    Carrie Mae

    Could be the update servers are overloaded. Keep trying.

  • Error when using SAP authentication for Designer

    my error is:
    [repo_proxy 13] SessionFacade::openSessionLogon with user info has failed(The
    secSAPR3 DLL could not be found or does not exist(hr=#0x80042a01)
    can you help me?
    regards

    hi,
    pls refer the link
    Error when using SAP authentication for Designer
    try re-installing BOE and check
    hope it helps,
    sundar

  • Audit "SELECT FOR UPDATE" statement

    Hi all
    My database is 10.2.0.3 and I enabled audit_trail to DB value already.
    My purpose I want to audit "SELECT FOR UPDATE" statement on the table and I tried to enable audit "SELECT" on the table that have many records in dba_audit_trail because "SELECT" statement that include in this audit and then I tried to enable audit "LOCK TABLE" on the table that doesn't have any records n dba_audit_trail.
    So my question is How to enable audit for collecting only "SELECT FOR UPDATE" statement? or anyone have any idea for this.
    Regards,
    Hiko

    taohiko wrote:
    Hi all
    My database is 10.2.0.3 and I enabled audit_trail to DB value already.
    My purpose I want to audit "SELECT FOR UPDATE" statement on the table and I tried to enable audit "SELECT" on the table that have many records in dba_audit_trail because "SELECT" statement that include in this audit and then I tried to enable audit "LOCK TABLE" on the table that doesn't have any records n dba_audit_trail.
    So my question is How to enable audit for collecting only "SELECT FOR UPDATE" statement? or anyone have any idea for this.
    A consideration on top of the comments made by Justin:
    You have an unfortunate version of the database for auditing: when you enable audit on 10.2.0.3 (or.2 or .1) the redo pattern changes - normally you will see a redo change vector for each row updated, but in these versions you will see two records, a "lock row" followed up "update row piece"; which means your volume of redo may increase significantly.
    I wrote a note about it some time ago: http://jonathanlewis.wordpress.com/2011/05/27/audit-ouch/ and one of the comments includes the bug number ( 5166745 ), reporting fixed in 10.2.0.4 and 11.1.0.6
    Regards
    Jonathan Lewis
    This is bug

  • [svn:fx-trunk] 10891: Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants

    Revision: 10891
    Author:   [email protected]
    Date:     2009-10-06 09:46:47 -0700 (Tue, 06 Oct 2009)
    Log Message:
    Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants
    QE notes: None.
    Doc notes: None
    Bugs: SDK-22676
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22676
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java

    Have you tried using com.adobe.air.crypto.EncryptionKeyGenerator instead?

  • "XSL Error: Cannot use a DTMLiaison for a input DOM node"

    This code:
    Writer writer = new StringWriter();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    // Note: event.getDocument() returns a
    // org.apache.xerces.dom.DocumentImpl
    // sourced from xlms.jar
    processor.process(new XSLTInputSource(event.getDocument()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(writer));
    Gives this stacktrace:
    XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a weblogic.apache.xalan.xpath.xdom.XercesLiaison
    instead!
    XSL Error: SAX Exception
    weblogic.apache.xalan.xslt.XSLProcessorException:
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1756)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1648)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:876)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:600)
    1. All XML/XSLT classes are being sourced from weblogic.jar or xmlx.jar
    2. Both jar files come from the WLS installation (WLS6.0 + SP2)
    3. There are no other XML class providers on my class path
    4. This is a standalone application, not running within WLS; I'm using weblogic
    jarfiles here purely so I use the same XML implementation both inside and outside
    WLS. Is this a sensible approach?
    Any help, anyone?

    All works fine in WLS6.1, with this extra code:
    System.setProperty("javax.xml.transform.TransformerFactory",
    "weblogic.apache.xalan.processor.TransformerFactoryImpl");
    (or you could use -D)
    No longer concerned; we've moved off WLS6.0
    "Simon Spruzen" <[email protected]> wrote:
    >
    Interestingly, expanding the code to (the very verbose):
    Document sourceDocument = event.getDocument();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    StringWriter source = new StringWriter();
    XMLSerializer sourceSerializer = new XMLSerializer(source, new OutputFormat(sourceDocument));
    sourceSerializer.asDOMSerializer();
    sourceSerializer.serialize(sourceDocument.getDocumentElement());
    StringWriter output = new StringWriter();
    processor.process(new XSLTInputSource(source.toString()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(output));
    (i.e. document -> string -> transform -> string)
    works just fine, but this code is far too long-winded for me to be happy
    with.
    (Note that one of XSLTInputSource's ctors does take a Node, so I'm assuming
    that
    it should be perfectly safe to pass a Document here)
    (Note also, that for various reasons at the moment, using JAXP's transformer
    factory
    is difficult for us)
    "Simon Spruzen" <[email protected]> wrote:
    This code:
    Writer writer = new StringWriter();
    XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
    // Note: event.getDocument() returns a
    // org.apache.xerces.dom.DocumentImpl
    // sourced from xlms.jar
    processor.process(new XSLTInputSource(event.getDocument()),
    new XSLTInputSource(new FileReader(GDS_XSLT_STYLESHEET)),
    new XSLTResultTarget(writer));
    Gives this stacktrace:
    XSL Error: Cannot use a DTMLiaison for a input DOM node... pass a weblogic.apache.xalan.xpath.xdom.XercesLiaison
    instead!
    XSL Error: SAX Exception
    weblogic.apache.xalan.xslt.XSLProcessorException:
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1756)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1648)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.getSourceTreeFromInput(XSLTEngineImpl.java:876)
         at weblogic.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java:600)
    1. All XML/XSLT classes are being sourced from weblogic.jar or xmlx.jar
    2. Both jar files come from the WLS installation (WLS6.0 + SP2)
    3. There are no other XML class providers on my class path
    4. This is a standalone application, not running within WLS; I'm using
    weblogic
    jarfiles here purely so I use the same XML implementation both inside
    and outside
    WLS. Is this a sensible approach?
    Any help, anyone?

  • Error occuring in SELECT statement FOR UPDATE when using WITH cluase

    Hi,
    Iam using oracle 11g version
    Iam having a query with fetch records for update insid with cluase as
    cursor c1 is
    With abc as (
    SELECT col1,col2 from table1, table2 where < condition>
    for update of <col1> skip locked
    select * from abc,table3 where <condition>
    union all
    select * from table4 where id not in (select * from abc)
    if i add "for update of <col1> skip locked" this cluase
    iam getting error ORA-00907: missing right parenthesis
    when i remove "for update of <col1> skip locked" the block is working fine..
    can i know why error is occuring i

    Hi, first of all, your placing of "for update" clause is wrong. It should be at the end like:
    With abc as (
    SELECT col1,col2 from table1, table2 where < condition>
    select * from abc,table3 where <condition>
    union all
    select * from table4 where id not in (select * from abc)
    for update of <col1> skip locked;Second, if you try to compile it with this syntax then you will get a new error.
    ORA-01786:     FOR UPDATE of this query expression is not allowed
    Cause:     An attempt was made to use a FOR UPDATE clause on the result of a set expression involving GROUP BY, DISTINCT, UNION, INTERSECT, or MINUS.
    Action:     Check the syntax, remove the FOR UPDATE clause, and retry the statement.So, you will not be successful with the union clause in your query.

  • Help on Procedure and trigger for updating(urgent please)

    SQL> / Table A
    CTUT_ID CTUT_COMPANY_NAME CURRT_USER_ID FMIS_ID CREATE_DA UPDATE_BY UPDATE_DATE
    1234 A 15-APR-03
    2222 B 15-APR-03
    3333 C 15-APR-03
    4444 D 15-APR-03
    5555 E 15-APR-03
    6666 F 15-APR-03
    150282 G oRACLE 23-APR-03
    1 H 15-APR-03
    2 I 15-APR-03
    3 J 15-APR-03
    150343 K TIGER 24-APR-03
    150305 L EXAMPLE 23-APR-03
    150342 M SCOTT 24-APR-03
    sQL >/ Table B
    Empno     Empname UPDATE_BY UPDATE_DATE
    1 AA
    2 BB
    3 CC
    4 DD
    What i need to do is i need to create an update trigger on both tables
    like create a procedure
    1)In procedure i need to check like
    IF TABLEA.CURRT_USER_ID = (SELECT USER FROM DUAL)
    THEN
    UPDATE_BY = (CURRENT_USER_ID of CTUT_ID)
    FOR EXAMPLE CURRENT USER_ID IS SCOTT THEN
    UPDATE_BY = 150342
    UPDATE_DATE = SYSDATE
    ELSIF
    UPDATE_BY <=> (CURRENT_USER_ID of CTUT_ID)
    THEN
    MESSAGE('USER IS NOT IN TABLE);
    END IF;
    and call that procedure in the update triggers
    FOR BOTH TABLES TABLEA,TABLEB
    i CREATED A PROCEDURE BUT IT IS NOT WORKING
    ANY HELP PLEASE
    CREATE OR REPLACE PROCEDURE UPDATE(
    UPDATE_DATE out DATE,
    UPDATE_BY out VARCHAR2)
    IS
    Uuser varchar2(20);
    Udate date;
    Ufound number(1);
    BEGIN
    SELECT USER,SYSDATE
    INTO Uuser,Udate from dual;
    SELECT count(*),CTUT_ID into Ufound,Uctut_id
    FROM TABLEA
    WHERE CURRT_USER_ID = Uuser
    Group by Ctut_id;
    IF (UFOUND = 1) THEN
    UPDATE_DATE := UDATE;
    UPDATE_BY := UCTUT_ID;
    END IF;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-20001,'User Does not Exist');
    END UPD_CONSTITUENT;
    CREATE A TRIGGER :
    CREATE OR REPLACE TRIGGER TU
    BEFORE INSERT ON TABLEA
    FOR EACH ROW
    BEGIN      
    UPDATE(:NEW.update_date,
         :NEW.update_BY);
    END IF;      
    END;
    SQL> update TABLEA
    2 set CTUT_COMPANY_NAME = 'SCOTT TEST'
    3 WHERE FMIS_USER_ID = 'N';
    update TABLEA
    ERROR at line 1:
    ORA-04091: table TABLEA is mutating, trigger/function may not see it
    ORA-06512: at "UPDATE", line 12
    ORA-06512: at "TU", line 1
    ORA-04088: error during execution of trigger 'TU'

    Hi Mara,
    You are right thats what i want
    I have a table A
    EmpNo Empname Currtuser_id Update_date Updateby
    1 Denis Oracle
    2 Scott Scott
    3 Mara MMara
    1)what i need to do is when any user tries to update the table Table A
    Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
    If his user id exits in table A
    Then allow him to update the TABLE A
    and insert his EMPNO in UPDATE_BY
    and SYSDATE in UPDATE_BY
    He will do all this process using forms
    But i need to have trigger or procedure in database level for table
    2) I have another table like 10 tables
    Suppose TABLE B
    When user tries to update TABLE B
    Then the Trigger or procedure should check whether user is exits in table A in column currtuser_id
    If his user id exits in table A
    Then allow him to update the TABLE B
    and insert his EMPNO in UPDATE_BY
    and SYSDATE in UPDATE_BY
    3) I need to have a common Procedure and call that procedure in all tables in UPDATE TRIGGER
    Thanks for your help
    Thanks

  • Error while using sybase trigger with the CMP entity bean,ejb version 2.1

    Hi All,
    I am using ejb version 2.1 and using entity bean (Transaction required) ,i am trying to update data in sybase(ver 12.3) database table
    I am using session bean(Transaction required) to update the multiple entity beans in a while loop.It is working fine .But when i am trying to run it with the trigger which updates multiple tables in different sybase databases on update of each entity.Then it throws NoSuchEntityException and it rollback the whole transaction.
    My trigger has only few simple update statements and the trigger runs fine without my CMP entity bean.is the CMP does not support the update triggers in sybase or is it the problem with the transaction.
    Please help
    Thanks
    Anshu

    If you can have a look at a cmp example in the samples that ship with the server. My guess is that the weblogic-ejb-jar.xml file is missing the <persistence-use> element which for 810 would look like:
    <persistence>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>7.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-use>
    </persistence>
    I seem to recall that the elements might be slightly different in structure for the wls700 version of the DTD, so please check that (I cannot, I'm at home and don't have everything here).
    Give that a try and see if it doesn't solve your compilation failure.
    Also, the compilation should not be throwing a null pointer exception in a case like that, I consider that to be a bug.
    -thorick

  • Problem in Wfetch client for Update operations

    Hi,
    I am using the Wfetch client for the 'Update' operation of an RFC Gateway consumption model . But it seems to always give this error : 'HTTP/1.0 400 Bad Request\r\n'
    I have passed only those fields that have been exposed in the GW Data model. Is there anything else that needs to be taken care of ?
    The read and query operations are executed successfully though.
    Thanks,
    Shubhada

    Hi Shubhada,
    Just recheck two things in Wfetch with below details.
    1. Check the path. It should be below formate for update operation
    Verb : Put
    Path:  /sap/opu/sdata/sap/<CONSUM_MODEL>/<data_model>Collection(value='  ',scheme_id='<DATA_MODEL>',scheme_agency_id='  ')?sap-client=< >&$format=xml
    Above formate you can take from Read operation which you already executed successfully.
    2. Check the XML formate on right handside in Wfetch it should be header & body with below details.
    Xml Formate:
    x-requested-with: XMLHttpRequest\r\n
    \r\n
    <?xml version="1.0" encoding="utf-8" standalone="yes"?>\r\n
      <entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">\r\n
          <content type="application/xml">\r\n
            <m:properties>\r\n
       <d:value> </d:value> \r\n
      <d:scheme_id> </d:scheme_id> \r\n
      <d:scheme_agency_id> </d:scheme_agency_id> \r\n
    Just copy from read operation Read operation which you already executed successfully. And update the fields what you required.
    </m:properties>\r\n
          </content>\r\n
    </entry>\r\n
    Hope you this will help above information.
    Thanks & Regards,
    Mahesh Devershetty

Maybe you are looking for

  • How can I stop iTunes in Windows 7 from coming to front when I am importing by inserting a CD?

    I've set iTunes (latest version as of this message) to "Import CD and eject" because I'm batch importing my CD collection. There's a delay of several seconds between when I insert a CD (after the last one was ejected) and when iTunes begins importing

  • Load Balancing Two Servers

    i have two Solaris servers running 9iAS R2 OC4j. current patch level is 9.0.2.3 i'm trying to load balance the instances according to the instructions in this document: Oracle9i Application Server: mod_oc4j Technical Overview all i should need to do

  • Help in Handling Japanese Content in Java

    We are facing following problem while inserting xml file (having Japanese content) into database. When we try to insert xml file as clob into the database japanese content is going into the database as some Corrupted data (Note: Tag names which are i

  • How to use Assignment Rate

    Hi all, Are there anybody know how to use assignment rates? Our organization use grade/step as salary schedule. everytime when people are only doing temporary job , we need to set up new grade and step which is not conveinent. we didn't enable the sa

  • Apologies, this item has been interrupted due to an error...

    Hi there. Recently i have changed motherboards/processors in my desktop PC (but kept the same hard drive). Since then, when i go to view Sky Go on my desktop, i get the following error message: "Apologies, this item has been interrupted due to an err