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

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.

  • 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;

  • Error: cannot commit (when inserting the row)

    hai,
    I create the trigger like below.
    create or replace trigger proce
    after insert on samp3
    declare
    ass date;
    begin
    select d into ass from samp3;
    updatecourse(ass);
    end;
    when I try to insert the row then the error is come;
    ERROR at line 1:
    ORA-20001: An error was encountered - -4092 -ERROR- ORA-04092: cannot COMMIT in a trigger
    ORA-06512: at "AUROLIVE.UPDATECOURSE", line 22
    ORA-06512: at "AUROLIVE.PROCE", line 5
    ORA-04088: error during execution of trigger 'AUROLIVE.PROCE'
    can any one help me?
    Regards,
    Ramya.S

    If u want to put commit on trigger use pragma
    autonomous_transaction.what it does,it leave the main
    transaction and commit the second transaction.Which can lead to logic problems and corruption of your business data if not used extremely carefully.
    If you start transaction 1 and during that write some other data as transaction 2 using autonomous transactions and then subsequently find that there is an error or some reason not to commit transaction 1 then you cannot automatically roll back transaction 2 and would have to take care of it manually.
    I see too many occurences of developers using autonomous transaction all over the place just because they want to get the data written to the database and then they're wondering why there is so much clutter in their data and the database integrity is poor from a business/logical point of view. The first thing any good design includes is a knowledge of the business transactions and when data should be committed and what the implications of using autonomous transactions are.

  • Java.sql.SQLException: You cannot commit during a managed transaction!

    Hi all,
    I'm just trying to get the tutorial Car EJP app to work with Jboss 3.2.1
    When creating a new car record by calling the car.edit() method it reaches
    the line
    pm.makePersistent (car);
    and then throws the exception
    com.solarmetric.kodo.runtime.FatalDataStoreException:
    com.solarmetric.kodo.runtime.FatalDataStoreException:
    java.sql.SQLException: You cannot commit during a managed transaction!
    [code=0;state=null]
    When checking the jboss log, it is clear that kodo is trying to commit the
    sequence update :
    at
    org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:477)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.commit(SQLExecutionManagerImpl.java:783)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory.updateSequence(DBSequenceFactory.java:267)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory.getNext(DBSequenceFactory.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.newDataStoreId(JDBCStoreManager.java:598)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistentFilter(PersistenceManagerImpl.java:1418)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:1348)
    at com.titan.kodojdotest.ejb.CarBean.edit(CarBean.java:51)
    How should i get this to work ????
    tx for your help,
    Roger.

    It appears that you are using ConnectionFactoryName. First be sure to
    set a ConnectionFactory2Name which will be a non-transactional (in terms
    of global transaction) DataSource for sequence generation for which you
    are seeing here. There are also some issues with JBoss's connection
    pooling on certain dbs if you are still seeing the problem after this.
    If so, try setting ConnectionURL, ConnectionPassword, etc explicitly
    Roger Laenen wrote:
    Hi all,
    I'm just trying to get the tutorial Car EJP app to work with Jboss 3.2.1
    When creating a new car record by calling the car.edit() method it reaches
    the line
    pm.makePersistent (car);
    and then throws the exception
    com.solarmetric.kodo.runtime.FatalDataStoreException:
    com.solarmetric.kodo.runtime.FatalDataStoreException:
    java.sql.SQLException: You cannot commit during a managed transaction!
    [code=0;state=null]
    When checking the jboss log, it is clear that kodo is trying to commit the
    sequence update :
    at
    org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:477)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.commit(SQLExecutionManagerImpl.java:783)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory.updateSequence(DBSequenceFactory.java:267)
    at
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory.getNext(DBSequenceFactory.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.newDataStoreId(JDBCStoreManager.java:598)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistentFilter(PersistenceManagerImpl.java:1418)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:1348)
    at com.titan.kodojdotest.ejb.CarBean.edit(CarBean.java:51)
    How should i get this to work ????
    tx for your help,
    Roger.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Cannot commit or rollback  a JDBC Connection from CAF project

    Hi Everybody,
    I'm working in CE 7.10. I have a CAF Project that gets a JDBC connection from a Custom Datasource to an external Database.
    Here is the code:
      try
        Context ctx = new InitialContext();
        DataSource ds = (DataSource) ctx.lookup("jdbc/MYDATABASE");               
        con = ds.getConnection();
        con.setAutoCommit(false);
        Statement statement = con.createStatement();
        String updateStatement = "UPDATE TABLE...";
        statement.executeUpdate(updateStatement);
        con.commit();
        catch(SQLException sqle){
             con.rollback();
    I got the following exception on line "con.setAutoCommit(false);":  --> "Cannot begin JDBC transaction from this connection of "MYDATABASE" DataSource. JTA transaction has already started."
    and the following on line "con.commit() / con.rollback()" : --> "Cannot commit JDBC transaction from this connection of "MYDATABASE" DataSource. This resource participates in a JTA transaction."
    If I run the same code from a webDynpro or a J2EE project it works ok, but not from a CAF Application Service. I tried to do it in a simple Class in the CAF Project and call this clas from the Application service, but I get the same error.
    Any Ideas??
    Thanks a lot!
    Regards.

    Solved with   "SessionContext.setRollbackOnly()" instruccion.
    Regards.

  • Cannot commit during managed transaction - MDB

    Hi
    I use message-driven bean to asynchronously send newsletters. To avoid restarting process from the beginning in case of any error, I save the recipients in database table, and remove row by row after email has been sent. To not mark my mail server as spammer I send it in chunks of 90 per minute. My recipients list is quite big, about 30k addresses. The code works perfect, but only few minutes... Then transaction is timed out, deleting of already sent recipients is not commited and the process begins again! That of course results in delivering the same message multiple times to the same recipients.
    I tried setting autocommit to false and forcing commit before thread going sleep, but I kept getting error "cannot commit managed transaction".
    Can anybody help?
    Michal
                int sentCount = 0;
                con = locator.getPGDataSource().getConnection();           
                PreparedStatement stmt = con.prepareStatement("SELECT * " +
                        "FROM mail_recipient " +
                        "WHERE task_id = ? " +
                        "ORDER BY id ASC " +
                        "LIMIT " + CHUNK_SIZE + " ");
                stmt.setInt(1, Integer.parseInt(id));
                ResultSet rs = stmt.executeQuery();
                StringBuffer sentIds = new StringBuffer();
                while(rs.next()) {
                    if(!checkInProgressStatus(file))
                        return;
                    email = rs.getString("email");
                    String from_address = getMailProperty(account, "mail");
                    String display_name = getMailProperty(account, "display_name");
                    InternetAddress inetAddr = new InternetAddress(from_address,
                            display_name);
                    Mail mail = new Mail(inetAddr,
                            getMailProperty(account, "username"),
                            getMailProperty(account, "password"));
                    try {
                        mail.sendEmail(email, subject, content);
                    } catch (MessagingException ex) {
                        log.error("Cannot send to: " + email + " - user " + rs.getInt("customer_id"));
                    sentIds.append(rs.getInt("id") + ",");               
                    if(++sentCount % CHUNK_SIZE == 0) {
                        try {
                            try {
                                rs.close();
                                stmt.close();
                                con.close();
                            } catch (SQLException ex) {                           
                            Connection con2 = null;
                            con2 = locator.getPGDataSource().getConnection();
                            PreparedStatement stmt2 =
                                    con2.prepareStatement("DELETE FROM mail_recipient " +
                                    "WHERE id IN(" +
                                    sentIds.substring(0, sentIds.length()-1) + ")");
                            stmt2.executeUpdate();
                            sentIds = new StringBuffer();
                            stmt2 = con2.prepareStatement("SELECT COUNT(*) " +
                                    "FROM mail_recipient " +
                                    "WHERE task_id = ?");
                            stmt2.setInt(1, Integer.parseInt(id));
                            ResultSet rs2 = stmt2.executeQuery();
                            rs2.next();
                            int count = rs2.getInt(1);
                            log.error(count + "");
                            taskNode.setAttribute("recipients_left", count + "");
                            saveXML(doc, file);
                            try {
                                rs2.close();
                                stmt2.close();
                                con2.close();
                            } catch (SQLException ex) {
                            Thread.sleep(60*1000);
                        } catch (InterruptedException ex) {
                        con = locator.getPGDataSource().getConnection();                  
                        stmt = con.prepareStatement("SELECT * " +
                                "FROM mail_recipient " +
                                "WHERE task_id = ? " +                           
                                "ORDER BY id ASC " +
                                "LIMIT " + CHUNK_SIZE + " ");
                        stmt.setInt(1, Integer.parseInt(id));
                        rs = stmt.executeQuery();
                }

    Using Kodo's connection pooling fixed the problem.
    Thanks for the help.
    Chris West wrote:
    I suspect JBoss connection pooling could be the problem. A couple of
    questions...
    1. Do you know which versions of JBoss have this problem.
    2. How do I configure Kodo to use it's own connection pool on JBoss?
    -Chris West
    Stephen Kim wrote:
    I would highly suggest using Kodo's connection pool first and see if
    that alleviates the problem. I recall JBoss having some connection pool
    issues in certain versions.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • 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... !

  • 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

  • Cannot commit changes: [SQL0204] OPENCUT99 in C104504M type *FILE not found

    Hi,
    Just i have created an browser application to see an AS400 file,also I have been followed the Developer book to UPDATE this file but I'm ready to update I'm getting this message
    Cannot commit changes: [SQL0204] OPENCUT99 in C104504M type *FILE not found
    someone can helpme with this issue

    This is the more appropriate place for this but it is a crosspost:
    http://forum.java.sun.com/thread.jspa?messageID=4467711

  • Cannot commit during managed transaction

    Using Kodo 2.5.2, JBoss 3.2.1, and the DefaultDS datasource (HSQL)
    provided by JBoss, I'm getting the following exception when calling
    PersistenceManager.makePersistent:
    java.sql.SQLException: You cannot commit during a managed transaction!
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLEx
    ceptions.java:58)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.handle(SQLExcept
    ions.java:43)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.newDataStoreI
    d(JDBCStoreManager.java:562)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistentFil
    ter(PersistenceManagerImpl.java:1450)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.makePersistent(Pe
    rsistenceManagerImpl.java:1380)
    Any idea why?
    -Chris

    Using Kodo's connection pooling fixed the problem.
    Thanks for the help.
    Chris West wrote:
    I suspect JBoss connection pooling could be the problem. A couple of
    questions...
    1. Do you know which versions of JBoss have this problem.
    2. How do I configure Kodo to use it's own connection pool on JBoss?
    -Chris West
    Stephen Kim wrote:
    I would highly suggest using Kodo's connection pool first and see if
    that alleviates the problem. I recall JBoss having some connection pool
    issues in certain versions.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Commit in Header Block, but cannot Commit in Control Block

    I am new to Oracle Forms, and would really appreciate your kind response.
    I am using Oracle Forms 6i, Client/Server environment, and no base tables.
    The DATA BLOCKS is divided into two areas: 1) HEADER, and 2) CONTROL. I successfully commit from the HEADER area, but cannot COMMIT nor CLEAR_FORM in the CONTROL area after Inserting records. What is causing this, and how can I get the application to Commit and Clear_Form?
    I also notice in Data Block - Control that I am still in QUERY mode after INSERTING records. Shouldn't I be in CHANGED mode, and if so how do I make sure I am in the correct mode after inserting records?
    Thanks in advance.
    Below is a sample of my codes:
    Data Block: HEADER
    - Items: CLONE_ITEMS
    - Triggers: WHEN-BUTTON-PRESSED
    create_security_id(:security_id,:first_name,:last_name,:middle_name,:prefix,:suffix,:ti_title_class);
    :header.CT_SECURITY_ID := :header.SECURITY_ID;
    go_item('cf_security_id');
    Program Units: CREATE_SECURITY_ID
    This section inserts the User_ID into the All_Users System table, and adds a record into the user defined SECURITY_USERS table. COMMIT is successfully done in this section.
    ------------------------------- Problems here - COMMIT not successful ---------------------------
    So we tried using: FORMS_DDL('COMMIT'); which works. However we cannot get the Clear_Block to Work. All other codes commented out does not work.
    Data Block: CONTROL
    - Items: COPY_USER
    - Triggers: WHEN-BUTTON-PRESSED
    Copy_User_Role_locations (:CT_SEUS_ID, :CF_SEUS_ID);
    IF :System.Form_Status <> 'QUERY' THEN
    Message('Error prevented Commit');
    RAISE Form_Trigger_Failure;
    End if;
    IF :System.Form_Status = 'QUERY' THEN
    Display_Message('QUERY MODE');
    END IF;
    IF :System.Form_Status = 'CHANGED' THEN
    Display_Message('CHANGED MODE');
    END IF;
    IF :System.Form_Status = 'NEW' THEN
    Display_Message('NEW/INSERT');
    END IF;
    IF Form_Success THEN
    display_message('Security user created Sucessfully '||:ct_seus_id);
    FORMS_DDL('COMMIT'); ---------This works
    FORMS_DDL('CLEAR_BLOCK'); --Does not work
    -- do_key('commit_form'); --Does not work
    -- clear_block; --Does not work
    -- set_block_property( 'header', INSERT_ALLOWED, PROPERTY_true);
    -- clear_form(DO_COMMIT); --Does not work
    END IF;
    Program Units: COPY_USER_ROLE_LOCATIONS
    This section fetches records with matching Security-ID, and INSERTS a copy of the record with the new ID. No commits is done in this section.

    Gerd,
    No the Header Block was not created through the Block_Wizard. The Form was copied from another, and modified accordingly. I inherited it with these issues which I am trying to fix.
    Omar,
    I tried using the Go_Block procedure with Clear_Block, but unfortunately it still did not work. I also tried doing Clear_Form, same results. Below are the codes I used in SAVE button, where I tried to commit and clear_block (Note that Display_Message is an inhouse function):
    Data Block: CONTROL
    Items: SAVE
    Triggers: When_Button_Pressed
    Display_Message('save..');
    FORMS_DDL('COMMIT');
    IF Form_Success THEN
    Display_Message('Transaction Completed Sucessfully');
    else
    Display_Message('Failure to Commit Security_User');
    end if;
    Go_Block('CONTROL');
    CLEAR_BLOCK ;
    ---CLEAR_FORM;
    IF Form_Success THEN
    Display_Message('Transaction Cleared Sucessfully');
    else
    Display_Message('Transaction Not Cleared');
    end if;
    Whereas the message "Transaction Completed Successfully" was received when I used FORMS_DDL('COMMIT'), I still got a "Transaction Not Cleared" message, and the data was not cleared from the screen. I would really like to to resolve this issue.
    I also would be grateful if someone could clarify what mode I should be in after Inserting records. Should I be in the Query Mode, or Changed Mode.
    Thanks a mil.
    Sonia.

  • Cannot commit updates

    work in jdev 11.1.2.3
    I create a EO/VO and drag and drop the data control to a jspx page with SUBMIT button.
    and also I drap and drop COMMIT, ROLLBACK button into the same page from the data contral panel.
    (and set the partial submit property to TRUE for these three button).
    and it runs:
    1.The SUBMIT is enabled, COMMIT, ROLLBACK are disabled when the page show.
    2.edit some fields on the page, and press SUBMIT, and the COMMIT, ROLLBACK are enabled.
    3.press the COMMIT, and it looks OK-refresh the page, shows the updated data for the fields. but I check the database in ORACLE SQL DEVELOPER. the data has not been changed yet.
    Why the COMMIT cannot work?
    Thanks.
    BAO

    Hi,Rajdeep
    Thank you very much for your kindness and patience to send me the sample you created! I'v download and have a try. Here is the results:
    1.Since there is a 1-1 (id,id) relation between VO1 and VO3, we cannot create new records for VO3 without violating PK constraint for EO.
    so I delete all VO3 page components and re-drag and drop VO1 from data control into the page again.
    --now the TREE display and adf-FORM components are all based on the same VO1, and also add createinsert, delete button for the page.
    and to my suprise, the newly created adf FORM components include all attributes from EO (employeeid,firstname,lastname,departmentid,email,hiredate...)
    --but the VO1 query only include 3 attributes (employeeid,firstname,lastname)
    -- and these three attributes can be seen under the DATA CONTROL structrue tree.
    and I went on..
    2.At the EmployeesEO attributes tab page, set the EmployeeId.type to DBSequence.--to create PK- employeeid automatically.
    3.Run the testView.jspx page.
    all seems ok even now:
    --the TREE at left panel display rightly.
    --the navigate button functions rightly for the right panel's emp form.and the records can be synced between the tree and the form.
    --DELETE->SUBMIT->COMMIT is ok.
    --edit some field ->SUBMIT-COMMIT is ok.
    but when I press CREATINSERT :
    --only three fields(employeeid,firstname,lastname) left on the page, others dispeared, and empoyeeid = -2,
    --press SUBMIT, warnnings to fill required fields showed: email,hiredate,jobid are requiring input.
    --press SUBMIT again, all fields(more than the above three) appeared again now. and filling all fields.
    --press SUBMIT again, no warnings.
    --press COMMIT, an error popup showed: ORA-01400: cannot insert a NULL ("HR"."EMPLOYEES"."EMPLOYEE_ID")
    ORA-06512: 在 line 1.
    --change employeeid = 2,
    --press COMMIT again.
    --data were saved succussfully now.
    BUT there are must have something wrong in the above process.
    and if i :
    At the EmployeesEO attributes tab page, set the EmployeeId.type to integer.
    and run Test.jspx:
    the tree and form cannot display correctly nowand there is an error on the log file:
    java.lang.ClassCastException: java.lang.Integer cannot be cast to oracle.jbo.domain.DBSequence
    Can you help me further to solve these problems?
    Thank you again.
    BAO
    Edited by: user6715237 on 2013-3-26 上午4:35

  • 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

  • Why we cannot commit inside BAPI and what if we call workflow inside BAPI?

    hi,
    can anyone tell me why we cannot use Commit statement inside BAPI ?
    Also what if in my BAPI ,i have triggered my workflow and through that can i commit??
    Regards,
    Mayank

    Hi,
    it is a part of the BAPI programming model that BAPIs use a certain transaction model. This transaction model says that one BAPI has to follow the so called ACID (atomar, consistent, isolated, durable) principle. To ensure that a BAPI is atomar you cannot put a commit work just anywhere in mid of a BAPI as this would violate the modell. Furthermore BAPIs shall allow external commit handling that means it has to be possible to include several BAPI calls in one LUW. For this there are BAPIs which are only for committing or rolling back a transaction. For more detailed information you can check as usual the SAP help [click me|http://help.sap.com/saphelp_nw04/helpdata/EN/a5/3ec8654ac011d1894e0000e829fbbd/frameset.htm]
    If would suppose that when you throw a workflow event it is triggered once the LUW is closed. At least SAP should work that way. But I have to admit in newer ABAP OO developments SAP often just calls the Event raising function module with the option to not wait for the DB commit. Seems there are some problems with the newer LUW concepts / OO and the old workflow technology. This can lead in worst case to events raised for objects which were rolled back later but SAP seems to accept that so it is in my oppinion an acceptable solution.
    Hope that helps a bit
    Roman

Maybe you are looking for

  • Withholding taxes not updated when program run in background

    Hi, in a z1 report i do:   SUBMIT z2   VIA JOB lc_jobname    NUMBER v_jobcount      WITH p_fecha  = p_fecha                                     WITH p_file   = v_file_in      WITH p_e_file = p_efile       WITH p_client = p_client      WITH p_test   =

  • Problems downloading photos into iPhoto

    Attached is an example of what is happening to about 10% of the photos I am downloading to iPhoto.  I tried 2 different camera and they bath had the same problem.  Any ideas?

  • US Ipod, UK Warrenty

    My friend got someone to bring him back a shuffle from America to him in the uk because its much cheaper. However, his earphones are knarked, and, since there covered by the warranty, he should be able to get them replaced/fixed right? Does it matter

  • How can I connect to IBM mainframe data base DB2.

    Hi All How can i connnect to DB2 batabase on Ibm mainframe through JDBC. Where can i get the JDBC driver for DB2.

  • Better results than you could achieve in a real-time onlining suite?

    Another for Zeb and anyone else who cares about color. HD for Indies (http://www.hdforindies.com/) reviews The DV Rebel's Guide by Stu Maschwitz. In a section, "Why so AE centric when such a pain - why not do in FCP?", Mike Curtis pseudo-interviews S