Commit in a Trigger

I'am looking for a possibility to issue a Commit within an Database-Trigger.
Any ideas?

If you are using Oracle 8i, you can use an autonomous transaction:
CREATE OR REPLACE TRIGGER trg
DECLARE
Pragma Autonomous_Transaction
BEGIN
dml stuff...
COMMIT;
END;
That should do it.
null

Similar Messages

  • SQL Error: ORA-04092: cannot COMMIT in a trigger

    Trying to drop the table inside the trigger but i'm unable to do it.
    SQL Error: ORA-04092: cannot COMMIT in a trigger
    I need to drop the table based on the some condition say condition is the archive table with more than millions of records which is of no use so i plan to drop the table.
    I will be inserting the the unwanted table to mytable ,mytable which is having the trigger will fire to drop the table.
    I need this to be done on automatic basis so i have chosen trigger.
    is there anyway of automatic other than trigger in this case.

    933663 wrote:
    Trying to drop the table inside the trigger but i'm unable to do it.
    SQL Error: ORA-04092: cannot COMMIT in a trigger
    I need to drop the table based on the some condition say condition is the archive table with more than millions of records which is of no use so i plan to drop the table.
    I will be inserting the the unwanted table to mytable ,mytable which is having the trigger will fire to drop the table.
    I need this to be done on automatic basis so i have chosen trigger.
    is there anyway of automatic other than trigger in this case.You can't COMMIT inside a trigger. Oracle issue an auto COMMIT before and after the execution of DDL. So you can't use DDL in trigger. You may get suggestion to use AUTONOMOUS_TRANSACTION to perform COMMIT within tirgger. But dont do that. Its wrong idea.
    I will suggest you look back into your requirement and see what exactly you want. You could schedule a job that runs on a daily basis that will pick up the object details from your table and drop them accordingly.

  • Commit in a trigger,Confusion

    Hello experts,
    I am new in oracle using oracle sql developer in windows7.I am little bit confuse in that I am using commit in a trigger as given :
    create or replace
    trigger comt after insert on tbl_city
    declare
    pragma autonomous_transaction;
    begin
    commit;
    dbms_output.put_line('Value is committed');
    end;
    Now when I perform an
    insert into tbl_city values (1,'XYZ',1);
    in tbl_city---->trigger fires properly and gives an output stream
    .Value is committed
    But If I perform
    rollback
    now --->there are the data rollbacked in table.
    why this is happen ?I think after commit(which is in trigger associated at insert to table)there should no any rollback in table.
    Please give me solution.
    Thank You
    regards
    aaditya.

    Hi,
        For your Better Understand of Autonomous transaction., follow My Code, feel the magic of Autonomous transaction.
    Step1: Execute this block without giving commit.
    Create Table emp1(sal number);    
    declare
    begin
    for i in 1..5 loop
          INSERT INTO emp1
                      (sal
               VALUES (i
                      end loop;
    end;
    Step 2: Execute this Block used Autonomous transaction.
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
       BEGIN
          for i in 1..10 loop
          INSERT INTO emp1
                      (sal
               VALUES (i
                      end loop;
    commit;               
    END;
    Totally 15 rows u have inserted into emp table on SAL column right.
    Now Give ROLLBACK...
    And issue select statement now,
    Select * from emp1;
    you can get to know still the 10 rows remaing .. that's the use of PRAGMA AUTONOMOUS_TRANSACTION.
    for commiting the session wise transactions...
    Cheers... !

  • Cannot COMMIT in a trigger

    I'm getting this error in an After Insert trigger. This trigger is calling a stored procedure which is trying to reindex using "alter index myindex rebuild". This index is on the same table as the trigger.
    Also, where and how can I find information on errors returned by Oracle..
    Thanks in advance, Newbee Jerry
    null

    Hi Jerry , you can't put commit on triggers because the trigger will be part of one Transaction and this transaction won't finish until every triggers are finished. If you put a commit in one trigger you are forcing a "end of transaction " and this is not correct because you don't know if the transaction realy termineted. With this concept you can't do anything that has a commit in any trigger .
    See you ,
    Lourival

  • FRM-40735:KEY-COMMIT  ORA-02291 trigger raised unhandled exception

    FRM-40735:KEY-COMMIT ORA-02291 trigger raised unhandled exception. when i tried to save records.
    I am using multi record block , 12 records will display at a time, i am trying to save 1st and 5th record which i changed.
    calling a procedure in key-commit trigger
    PROCEDURE desig_updation IS
    V_count number := get_block_property('employee_master',query_hits);
    BEGIN
    go_block('employee_master');
    first_record;
    for i in 1.. V_count loop
         if((:desig is not null ) and (:new_date is not null) and (:emp_desig<>:desig) and (:new_date >=:emp_desig_date)) then
              :emp_desig :=:desig;
              :emp_grade:=:grade;
              :emp_desig_date:=:new_date;
              :emp_upd_by:=:global.usr;
              :emp_upd_on:=:system.current_datetime;
              if( (:radio_group=2) and (:incr_amt is not null)) then
                   increment_process;
                   end if;
         end if;
         if :system.last_record ='TRUE' then exit;
         else next_record;
         end if;     
    end loop;
    END;
    PROCEDURE commit_action IS
    BEGIN
    desig_updation;
    commit_form;
    IF FORM_SUCCESS THEN
    CLEAR_FORM(NO_VALIDATE);
    EXECUTE_TRIGGER('PRE-FORM');
    END IF;     
    END;
    key-commit-trigger
    commit_action;
    commit_form;
    IF FORM_SUCCESS THEN
    CLEAR_FORM(NO_VALIDATE);
    EXECUTE_TRIGGER('PRE-FORM');
    END IF;
    PROCEDURE increment_process IS
    m_gross_sal number;
    p_rslt varchar2(200);
    p_status varchar2(20);
    BEGIN
    delete from INCR_TEMP where ECODE = :emp_code ;
    m_gross_sal := aod_gross_salary(:emp_orgn,:emp_code,'A');--find current salary
    insert into INCR_TEMP(ECODE , CURR_SAL ,
    INCREMENT_AMT ,TOTAL_AOD,
    STATUS,INCR_TYPE)
    values(:emp_code,m_gross_sal,
    :incr_amt,m_gross_sal+:incr_amt,
    'N','I');
    forms_ddl('commit');
    update_emp_increment(:emp_orgn,:emp_code,
    TRUNC(to_date(to_char(:new_Date,'DD/MM/YYYY'),'DD/MM/YYYY')),null,
    :incr_amt, p_rslt,
    :parameter.p_user,to_date(to_char(SYSDATE,'DD/MM/YYYY'),'DD/MM/YYYY'),'I',
    p_status);
    END;
    thanks,
    rinz

    It seems you are insert some data in child table. For which parent data does not exist. In simple primary key values does not exist while you are trying to insert in foreign key values. check this link.
    http://www.lmgtfy.com/?q=ORA-02291
    -Ammad

  • ORA-04092: cannot COMMIT in a trigger - Please advise on solution

    Hi guys,
    I know this error has been explained in the forum before and I understand where the error comes from, but I need expert's opinion to make the trigger works.
    Here is the actual situation:
    Table A has a trigger on after insert, and BASED ON THE LAST ROW inserted (only this data is subject to the trigger's actions) does the following:
    1. MERGE the data (last row from the source table=A) with the data from the table destination=B. This data is specific to an employee;
    2. Open a cursor that goes through all the ancestors of the employee (I have an employees hierarchy) and MERGE the same data (but for ancestors) with the table destination;
    To be more specific :
    EmpID LOB Day Status
    12 1007 29 Solved
    EmpID has ancestors 24 and 95. Therefore in the destination table I will have to do:
    1. Merge data for EmpID 12;
    2. Merge data for EmpID 24, 95:
    EmpID LOB Day Status
    24 1007 29 Just S (this is the status for ancestors)
    95 1007 29 Just S
    Steps 1 and 2 are inside a PL/SQL procedure that works fine by itself, but not within the trigger (since there are many transactions on the destination table). These 2 steps are required because for EmpID 12 I set a status and for the ancestors I set up a different status (this was the only way I could think of).
    Can someone give me a hint how should I handle this situation ?
    Thank you,
    John

    Try this
    create or replace procedure SEQ
    is
    pragma AUTONOMOUS_TRANSACTION;
    BEGIN
    EXECUTE IMMEDIATE 'create sequence ' || V_PROD ||
    ' minvalue 1 maxvalue 999999 start with 1';
    END;
    CREATE OR REPLACE TRIGGER TRG_GEN_SEQUENCES
    BEFORE INSERT on MASTER_TABLE
    FOR EACH ROW
    DECLARE
    V_PROD VARCHAR2(5);
    N_ID NUMBER := 0;
    CT NUMBER := 0;
    ERR_MSG VARCHAR2(2000);
    BEGIN
    -- Retrieve the ID e of the last inserted row which is 100 by default
    -- set the default client_id value with nextvalue of sequence prod_IDS
    IF :NEW.ID = 100 THEN
    V_PROD := :NEW.PROD;
    SELECT PROD_IDS.NEXTVAL INTO N_ID FROM DUAL;
    :NEW.ID := N_ID;
    END IF;
    BEGIN
    SELECT COUNT(*)
    INTO CT
    FROM USER_SEQUENCES US
    WHERE UPPER(US.SEQUENCE_NAME) = UPPER(V_PROD);
    IF CT = 0 THEN
    -- create the sequence with name of V_PROD if doesn't exist
    INSERT INTO CDR_SQL_ERR
    (DB_OBJ, ERR_MSG, PROC_DATE)
    VALUES
    ('TRG_GEN_SEQUENCES',
    V_PROD || ' sequence will be created ', SYSDATE);
    --EXECUTE IMMEDIATE 'create sequence ' || V_PROD ||
    ---' minvalue 1 maxvalue 999999 start with 1';
    begin
    SEQ;
    end;
    ELSE
    INSERT INTO CDR_SQL_ERR
    (DB_OBJ, ERR_MSG, PROC_DATE)
    VALUES
    ('TRG_GEN_SEQUENCES',
    V_PROD || ' sequence alreday exist',
    SYSDATE);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    ERR_MSG := TO_CHAR(SQLERRM) || ' ';
    INSERT INTO SQL_ERR
    (DB_OBJ, ERR_MSG, PROC_DATE)
    VALUES
    ('TRG_GEN_SEQUENCES', ERR_MSG || SEQ_DDL, SYSDATE);
    END;
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    ERR_MSG := TO_CHAR(SQLERRM) || ' ';
    INSERT INTO SQL_ERR
    (DB_OBJ, ERR_MSG, PROC_DATE)
    VALUES
    ('TRG_GEN_SEQUENCES', ERR_MSG || SEQ_DDL, SYSDATE);
    COMMIT;
    END;

  • No commit in trigger

    I have seen that there is no commit reqd. in trigger, the statements get auto-committed.
    Is it true?
    I hope, my question is clear. Please help in solving the doubt.
    regards.

    The trigger code executes in the same transaction the
    actula DML statements is running. Any commit or
    rollback to the actual DML statement equally applies
    to the statements in the triggerUnless trigger use AUTONOMOUS TRANSACTION - in this case you have to commit or rollback inside the trigger.

  • Why we cant use commit in trigger, can any one give proper explanation

    Why we cant use commit in trigger, can any one give proper explanation

    You shouldn't use a commit in a trigger if it's part of the same transaction as the action happening on the table.
    Eg. Suppose you have a table that stores details of orders, and it has a trigger that updates the stock table.
    If a customer comes along and creates an order but decides part way through that actually, they don't want the order after all, the transaction is rolled back.
    If you don't put a commit in the transaction, then the stock table details remain unchanged - no order, so no stock reduction. If, however, you forced the commit to happen in the trigger, you now have no order, but the stock table details have changed.
    That's not what you want to happen!
    Sometimes it does make sense to have a commit in the trigger, but this is very much the exception. If you come across a table mutating error, it usually means that you have a problem with your design and that you need to rethink it, NOT bodge it by using autonomous_transaction and a commit.
    Of course, the times when you'd use triggers should be few and far between - the above example is NOT how I'd code an orders-stock transaction; I'd have some PL/SQL that handled the transaction, rather than direct inserts onto the table.

  • Commit in trigger

    I want to delete rows in a table and then commit it using a procedure and a trigger. Documentation says we cannot use commit in a trigger. Can we use truncate instead? If yes how?

    Thanks for your response.
    I want to collect the list of procedures and packages in shared pool before shutting down the database and have created a table (coll_table) to collect this list. I have created a procedure for the same and in this procedure I said
    delete from coll_table;
    commit;
    To run this procedure I have created a trigger which fires at the database shutdown event. This trigger is giving me an error in alert log file. I studied on that error and came to know that I cannot use a commit in a trigger,now I want to know can I use a truncate instead of "delete from coll_table; commit;"?

  • No commit-message (FRM-40400) == Bug in Headstart

    Hello,
    On committing on or more business rules are violated the 'message-window' appear.
    After correcting the errors and committing the changes i'm not getting the usual
    'commit-message' (FRM-40400). This only happens after on or more business rules are violated.
    This is caused by a bug in the procedure 'QMS$FORMS_ERRORS.PUSH'. Below the solution i have implemented (the complete procedure is displayed). I'm using version 6.5.4.0 of the library 'qmslib65.pll.
    PROCEDURE Push
    ( p_msg IN VARCHAR2
    , p_error IN VARCHAR2 DEFAULT 'I'
    , p_msg_type IN VARCHAR2 DEFAULT ''
    , p_msgid IN NUMBER DEFAULT 0
    , p_loc IN VARCHAR2 DEFAULT '') IS
    -- Purpose Show message to the end-user, standard procedure for the Oracle Forms
    -- Generator of Designer/2000 to pass the display and handling of a message
    -- to a user created procedure.
    -- Usage Called by the Oracle Forms Generator code
    -- Parameters : msg Text message
    -- error ERRor or WARNing
    -- msg_type ORA, API or user TLA
    -- msg_id Id of message
    -- loc Location where error occured
    -- Remarks
    v_msg VARCHAR2(2000) := p_msg;
    v_error VARCHAR2(2000) := p_error;
    v_servermsg VARCHAR2(2000) := DBMS_ERROR_TEXT;
    l_empty_errorrec hil_Message.message_rectype;
    BEGIN
    IF p_msgid != 0
    THEN
    g_errorrec.severity := p_error;
    ELSIF ((SUBSTR (v_msg, 1, 11) = 'API Error: ')) OR
    ((INSTR (v_servermsg, 'ORA-20999') <> 0) AND (v_msg IS NULL)) OR
    (INSTR (v_msg, 'ORA-20999') <> 0)
    THEN
    -- error returned from the API, just display no further action required ?
    HandleServerAPIError (p_msg);
    -- M. Kappel
    /* 11-apr-2001
    - Allow check of v_servermsg even if v_msg contains data.
    - With new-style cdm ruleframe, v_msg contains 'ORA-20998'.
    We never looked at v_servermsg because v_msg was not null.
    - With old-style database trigger business logic, v_msg contains only text.
    If we still never look at v_servermsg, we don't identify that the error is
    a 20998 and therefore we raise an alert 'Transaction Failed' instead of
    showing the 'Errors in this Transaction' window.
    -- ELSIF ((INSTR (v_servermsg, 'ORA-20998') <> 0) AND (v_msg IS NULL)) OR
    -- (INSTR (v_msg, 'ORA-20998') <> 0)
    -- THEN
    On committing on or more business rules are violated the 'message-window' appear.
    After correcting the errors and committing the changes i'm not getting the usual
    'commit-message' (FRM-40400). This only happens after on or more business rules are violated.
    When one or more business rules are violated application error ORA-20998 is raised. To
    detect this DBMS_ERROR_TEXT is used ==> DBMS_ERROR_TEXT contains ALWAYS the text of the
    LAST (dbms-)error (the text contains 'ORA-20998').
    Even when no business rules are violated it's possible that DBMS_ERROR_TEXT contains 'ORA-20998'.
    In that case no FRM-, MNU-, PLS-, SRW-, ORA- or REP-messages are displayed, because the error is
    treated as a voilation of one or more business rules. To avoid this 'v_error = E' is added to the IF-clause:
    when one or more business rule are violated this procedure is called to display an error (p_error ==> E);
    for displaying the FRM-, MNU-, PLS-, SRW-, ORA- and REP-messages this procedure is called to display an
    information (p_error ==> I).
    When Designer generates code to validate p.e. check-constraints it will call this procedure too. See the example
    below:
    IF (:FUNCTIES.MIN_LEEFTIJD < :FUNCTIES.MAX_LEEFTIJD) THEN
    NULL;
    ELSE
    qms$forms_errors.push('CBB-00219', 'E', 'OFG', 0);
    qms$forms_errors.raise_failure;
    END IF;
    In this case the procedure is called to display an error. To avoid that the error is incorecctly treated as a
    violation of one or more business rules '(p_msg_type != 'OFG' or p_msg_type is null)' is added to the IF-clause.
    ELSIF v_error = 'E'
    AND (p_msg_type != 'OFG' or p_msg_type is null)
    AND ( INSTR (v_servermsg, 'ORA-20998') <> 0
    OR INSTR (v_msg, 'ORA-20998') <> 0
    THEN
    HandleServerApplError (p_msg);
    -- error returned from the API, just display no further action required ?
    ELSIF ((INSTR (v_servermsg, 'ORA-20000') <> 0) AND (v_msg IS NULL)) OR
    (INSTR (v_msg, 'ORA-20000') <> 0)
    THEN
    -- error was raised by old Headstart code with raise_application_error
    -- strip ora-20000 : , check if code (get message) or message
    HandleOldHeadstart (v_servermsg);
    ELSIF (SUBSTR (v_msg, 1, 3) IN ('FRM', 'MNU', 'PLS', 'SRW', 'ORA', 'REP'))
    THEN
    HandleOracleError (v_msg, v_error);
    ELSE
         HandleApplError(v_msg, v_error);
    END IF;
    Display_Error (g_errorrec);
    g_errorrec := l_empty_errorrec;
    END Push;

    you can create a KEY-COMMIT form level trigger with the following :
    declare
    msglvl varchar2(3) := :system.message_level ;
    begin
    :system.message_level := 5 ;
    commit_form ;
    :system.message_level := msglvl ;
    end ;
    or put instruction : clear_message; before the commit_form ;

  • Error in after insert trigger

    Hello all,
    I have a question about after insert trigger. Will be new row inserted and commited if after insert trigger returns error? Thank you.
    regards,
    Miha

    What is the error that u r facing?
    there could multiple reasons for that. Basically, u can't put commit in the trigger (unless it is an autonomous transaction). Share the pseudo-code of u r triiger, so that , problem can be identified.
    Cheers,
    Ram Kanala

  • Executing a shell script from a Trigger

    All,
    I have to write a script to do the following requirement.
    There is a file called BUSINESS_DATE.TXT.
    This file get updated once the oracle partition created. In Oracle, Partition will be created every day. There is a seperate script scheduled to take care ORACLE partition creation.
    The above file will have only one row. i.e
    03092012
    If Oracle partition creation job failed, the above file won't be updated.
    My requirement is,
    I have to check whether the BUSINESS_DATE file is updated today or not. If yes, I will have to move the files from common area to input file directory to process those files.
    All file name will amend with current date.
    i.e
    LIDDIFD03092012.TXT
    The key part is to check the BUSINESS_DATE.TXT file is updated properly or not.
    We don't know what time the file will get updated. So we are planning to schedule the new script to run for every 15 mins to check whether the file is updated or not
    But...I just thougt instead of writing a shell script to do the above one, Why shouldn't I capture the date in a table (New table needs to be created) and use ORACLE TRIGGER to run the shell script to move the files from common area to input file directory to process those files?
    My Proposal in ORACLE :
    Create table business_date
    rep_date varchar(15),
    curr_timestamp timestamp
    Once the oracle partition created , one row will be inserted into the above table. This adjustment needs to be implemented partition script.
    Once this table get record, TRIGGER should call SHELL SCRIPT to move the files from common area to input area.
    If I implement ORACLE TRIGGER, The script which will check whether the file got updated or not for 15 mins is not required. Right? Inputs from experts are welcome!

    >
    But...I just thougt instead of writing a shell script to do the above one, Why shouldn't I capture the date in a table (New table needs to be created) and use ORACLE TRIGGER to run the shell script to move the files from common area to input file directory to process those files?
    >
    Triggers should not be used to do transactional work. There is no COMMIT in a trigger. What happens if the trigger runs the shell script and then a ROLLBACK occurs? You will have run the shell script when it shouldn't run.
    Create a stored procedure to run the shell script. Call the stored procedure when the partition is created.
    If you were using 11g and interval paritioning you wouldn't need to create the partitions manually. Oracle could create the partitions automatically.

  • How to run DDL in a Trigger?

    I am trying to create a trigger that automatically sets the quota for any new users created in the database. However, I am running into the follow error because whenever you run DDL, Oracle automatically commits, which you can't do in a trigger. Does anyone have any ideas on how to get around this? We are on Oracle 11gR1.
    . The problem is, I am getting an ERROR at line 1:
    ORA-04092: cannot COMMIT in a trigger
    CREATE OR REPLACE TRIGGER TESTER.AUTO_QUOTA
    AFTER INSERT ON USERS FOR EACH ROW
    DECLARE
    sqlstmt     VARCHAR2(100);
    BEGIN
    sqlstmt:='ALTER USER ' || :NEW.USERNAME || ' QUOTA UNLIMITED ON ' || :NEW.TABLESPACE_NAME;
    execute IMMEDIATE SQLSTMT;
    END;
    /

    ji**** wrote:
    I am trying to create a trigger that automatically sets the quota for any new users created in the database. However, I am running into the follow error because whenever you run DDL, Oracle automatically commits, which you can't do in a trigger. Does anyone have any ideas on how to get around this? We are on Oracle 11gR1.This approach is wrong.
    What is the purpose of a trigger? The answer is protecting the integrity of the transaction - not to do "extra stuff" outside the current actual business transaction. Like sending e-mails. Or SMS's. Or issue DDL commands.
    What happens when you do "extra stuff" in that trigger and the transaction is rolled back for example? What now happens to that "extra stuff" that should not have existed/have been done in the first place?
    The correct approach is to create a procedure or package that does this "extra stuff". Then schedule a job from this trigger to call that procedure.
    When the transaction commits, so too is the job to do the "extra stuff". If the trigger is rolled back, so too the submission of the job. And the trigger does not need smelly approaches like autonomous transactions for getting "extra stuff" done.

  • Problem with a trigger

    I have a problem with a very simple trigger:
    CREATE OR REPLACE TRIGGER contratos_factuali
    AFTER UPDATE OF descrip,fautori,origpeso,origdls,
    montopeso,montodls,aant,aact,fifiobserva,pedsap
    ON ulises.contratos
    FOR EACH ROW
    BEGIN
    UPDATE contratos SET factuali=TO_DATE(SYSDATE,'DD/MM/YYYY HH24:MI')
    WHERE ncontra=:NEW.ncontra;
    COMMIT;
    END;This trigger update the column 'factuali' of this table everytime any other column of this table is updated. But returns me an error:
    SQL> update contratos set montodls=1 where ncontra='ODPS-086/00';
    update contratos set montodls=1 where ncontra='ODPS-086/00'
    ERROR at line 1:
    ORA-04091: table ULISES.CONTRATOS is mutating, trigger/function may not see it
    ORA-06512: at "ULISES.CONTRATOS_FACTUALI", line 2
    ORA-04088: error during execution of trigger 'ULISES.CONTRATOS_FACTUALI'What's happening?

    (1) You cannot use DML to update the table on which the trigger is based. Think about it: your trigger fires on UPDATE so each time fires, it updates the table and fires again. This is what is known as mutation.
    What you should do is create a trigger that executes BEFORE the update and simply do
    :NEW.factuali := SYSDATE;
    If ncontra is not a unique column and you genuinely want all rows of the same value to have the same factuali timestamp, well, it's very difficult, indeed I don't think it can be done. You could try submitting a DBMS_JOB to do the update, passing in the factuali value as a parameter; that DBMS_JOB would have to disable the trigger before doing the update (to prevent the recursion) and then re-enable it afterwards. Which seems like a lot of work: are you sure your design is correct?
    (2) You don't need the commit statement: the triggere exectutes within the commit phase of the original update.
    HTH, APC

  • How to refresh materialized view by trigger

    hi,
    im having a problem in refreshing materialized view through a trigger.
    CREATE OR REPLACE TRIGGER L_TRG_MARC_TEST
    BEFORE DELETE OR INSERT OR UPDATE ON MARC_BOOK_B_ENG
    BEGIN
    DBMS_MVIEW.REFRESH('TITLE_ENG_MV','C','',TRUE,FALSE,0,0,0,TRUE);
    END;
    Trigger created.
    SQL> DELETE FROM MARC_BOOK_B_ENG;
    DELETE FROM MARC_BOOK_B_ENG
    ERROR at line 1:
    ORA-04092: cannot COMMIT in a trigger
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 849
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 832
    ORA-06512: at "LIBQAL1.L_TRG_MARC_TEST", line 2
    ORA-04088: error during execution of trigger 'LIBQAL1.L_TRG_MARC_TEST'
    plz tell me how to refresh materialized view thru trigger,,and what is wrong in above mentioned situation.
    Regards

    DBMS_MVIEW.REFRESH implicitly commits. COMMIT is not permitted in triggers, as you can see, unless you use AUTONOMOUS_TRANSACTION.
    Try
    CREATE OR REPLACE TRIGGER L_TRG_MARC_TEST
    BEFORE DELETE OR INSERT OR UPDATE ON MARC_BOOK_B_ENG
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    DBMS_MVIEW.REFRESH('TITLE_ENG_MV','C','',TRUE,FALSE,0,0,0,TRUE);
    END;

Maybe you are looking for

  • Will I be able to use my current Photoshop CC on a new computer when I upgrade?

    I am looking into using Photoshop CC ($9.99/mo). I need a new program right now on my current laptop. I plan to upgrade my laptop at the end of the year. Will I be able to use the same Photoshop account?

  • Lightroom opens Photoshop from backup drive

    Sometimes LR opens PSCC 2014 from my attached BOOT CLONE (backup) drive, causing two concurrently running instances. This will happen if I have previously opened PSCC14 from the dock to load an image. LR doesn't realize PS is already running and open

  • Problems with Intel 4965AGN and iwlagn kernel module

    Hi everyone. I having a couple of issues since my last kernel upgrade (2.6.27.5-1) and wanted to check if its my problem or if it is some kind of bug, before reporting it to the tracker. I have the iwlagn (or iwl4965, as it is the same) kernel module

  • You can't perform price determination /You must first allow price determina

    Hi Friends, While performing the t code CKMH (Single level price determination) I am putting plant, period and fiscal year but when i am going to execute I m getting the following error. 1.you cannot perform price determination in period 01/2009. whe

  • JRun 3 on Vista IIS7

    Having some problems configuring IIS7 (Vista) to run JRun 3 applications. Using a basic JSP page as an example, here is there error I get: HTTP Error 404.0 - Not Found Description: The resource you are looking for has been removed, had its name chang