Errors with post-insert trigger

I had a POST-INSERT TRIGGER here.but i encountered some problems.can someone help me with the errors?
begin
     insert into user_acct
     userid_n, user_m, coy_c, contact_n, emp_n,
     work_loc_c, curr_passwd_t, prt_f, indv_pc_f, pc_deploy_c,      
     ext_email_addr_t, other_na_sys_t, status_c, status_rmk_t, upd_d)
     values
     (:user_acct.userid_n, :user_acct.user_m, :user_acct.coy_c, :user_acct.contact_n, :user_acct.emp_n,
     :user_acct.work_loc_c, :user_acct.curr_passwd_t, :user_acct.prt_f, :user_acct.indv_pc_f, :user_acct.pc_deploy_c,                
     :user_acct.ext_email_addr_t, :user_acct.other_na_sys_t, :user_acct.status_c, :user_acct.status_rmk_t,                
     :user_acct.upd_d);
     exception
          when others then
               clear_message;
               Message('Insertion of Applicant Particulars failed');
               SYNCHRONIZE;
               RAISE Form_Trigger_failure;
end;
begin
insert into user_acct_na_detl
     na_sys_c)
     values
     (:na_sys_cd.na_sys_c);
     exception
          when others then
               clear_message;
               Message('Insertion of Non-Application failed');
               SYNCHRONIZE;
               RAISE Form_Trigger_failure;
end;
          when others then
               null;      
end;     
the error:
Error 103 at line 31, column 3
Encountered the symbol 'WHEN' when expecting one if the following:
begin declare end exception exit for goto if loop mod null
pragma raise return select update while <an identifier>
<a double-quoted delimited-identifier><a bind variable><<
close current delete fetch lock insert open rollback
savepoint set sql commit<a single-quoted SQL string>
The symbol "exception"was substituted for "WHEN" to continue
Error 103 at line 2, column 1
Encountered the symbol "END"

i delete the "END" already but when i compile again, i encountered some error again.
Error 370 at line 27, column
OTHERS handler must be last among the exception handlers of a block
Error 0 at line 1, column 1
Statement ignored

Similar Messages

  • Error in post insert trigger

    Hi to all,
    In a table I have a field id that must be valorized from sequence.
    It is possible valorize this sequence after the insert ?
    I have tried to create a trigger like this:
    CREATE OR REPLACE TRIGGER MYSCHEMA.POST_USERACCOUNTS_INSERT
    AFTER INSERT
    ON MYSCHEMA.USERACCOUNTS
    REFERENCING NEW AS New OLD AS Old
    FOR EACH ROW
    DECLARE
    tmpVar NUMBER;
    BEGIN
       tmpVar := 0;
       SELECT SEQ_USERACCOUNTS_ID.NEXTVAL INTO tmpVar FROM dual;
       :NEW.USERS_ID := tmpVar;
       :NEW.DATECREATION := SYSDATE;
       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           RAISE;
    END POST_USERACCOUNTS_INSERT;But the creation abort with this error:
    ORA-04084: cannot change NEW values for this trigger type
    How can resolve this problem ?
    Thank You for help.
    Greetings...
    Gaetano

    Cause
    New trigger variables can only be changed in before row insert or update triggers.
    Action
    Change the trigger type or remove the variable reference.

  • Execution of ddl statement  in post-insert trigger

    hi,
    I'm working on headstart 6.5. I wants to execute a DDL statement in post-insert-trigger.The problem is this trigger is executed in between pre-commit and post-forms-commit.In pre-commit the transaction is opened with a insert statement that is inserting "open" in field status which is having a deffered check constraint QMS_NEED_TO_CLOSE_TRANSACTION.In post-forms-commit it will check whether the transaction is open if yes will check the business rule will delete the data that was inserted into qms_transaction in pre-commit trigger and will close the transaction .
         In between if i execute a DDl statement a commit will be performed on the insert statement written in pre-commit trigger.This will violate the check-constraint and we will get the error qms_need_to_close_transaction violated.
         My business logic wants this statement to be executed at the post-insert trigger on the block.Is this possible??
         Does anyone have face the same problem?Whts the workaround for the same?

    Hello,
    You could use the execute_query after the commit_form called, by exeample in a KEY-COMMIT trigger.
    KEY-COMMIT trigger
      Commit_Form ;
      Go_block( 'master_block' ) ;
      Execute_Query ;Francois

  • Post insert trigger

    let say i define a post insert trigger for a datablock , then when this will be execute ?, after the insert is performed , in another words will the trigger wait till a comfirmation message is send from the database or let say that the insertion is not completed becuse of network failure then will the trigger execute?

    Hi,
    In Metalink document 61675.1 you can find the trigger execution sequence for Forms 4.5. I can't find the trigger execution sequence for Forms 6i, but I think this should be the same for most events.
    For the event "create record", see the following triggers:
    Create Record 1. Post-Change Block
    2. When-Validate-Item Block
    3. Post-Text-Item Block
    4. When-Validate-Record Block
    5. Post-Record Block
    6. Post-Block Block
    7. On-Savepoint Form
    8. Pre-Commit Form
    9. Pre-Insert Block
    10. On-Insert Form
    11. Post-Insert Block
    12. Post-Forms-Commit Form
    13. On-Commit Form
    14. Post-Database-Commit Form
    15. Pre-Block Block
    16. Pre-Record Block
    17. Pre-Text-Item Block
    18. When-New-Item-Instance Form
    So it seems the the Post-Insert trigger fires AFTER the insert is performed. The insert will be performed in the On-Insert trigger.
    HTH
    Kind regards,
    Lennart de Vos

  • Compilation error in  AFTER INSERT TRIGGER

    I am getting a compilation error with this code. How can I make this work?
    CREATE OR REPLACE TRIGGER LIMS.u_tu_background_priority
        AFTER INSERT
        ON BACKGROUND
         FOR EACH ROW
    BEGIN
        IF instr(:new.parameter,'S') = 1 THEN
            UPDATE lims.background
            SET priority = 3
              WHERE background_id = :new.background_id
        END IF ;       
    END ;
    /

    TABLE background
    Name                                      Null?    Type                       
    BACKGROUND_ID                             NOT NULL NUMBER(16)                 
    PRIORITY                                           NUMBER                     
    SESSION_ID                                         NUMBER(16)                 
    SCHEDULE_ID                                        NUMBER(16)                 
    WORKSTATION_ID                                     NUMBER(16)                 
    WORKSTATION_GROUP_ID                               NUMBER(16)                 
    PARAMETER                                          VARCHAR2(4000)             
    ACTIVE                                             CHAR(1)                    
    BACKGROUND_TASK_TYPE_ID                            NUMBER(16)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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

  • Problem with post query trigger

    Hi,
    I have a multi record block and there is a post-query trigger on it. Based on values of this block I populate other values over the other control block.
    I wrote code in post-query trigger and when I execute the query and go to last but one record. The values in the control block are from last record instead of last but one record. Pls help me to fix
    Thanks,

    if you want to see the data in the control block synchronized with the database block then use the WHEN-NEW-RECORD-INSTANCE and not the POST-QUERY.
    with the POQ you add additional data (in non-basetable-items) to the records in the database block

  • Error from Pre-Insert Trigger

    I am using the following code in Pre-insert trigger
    purpose is that all the record which do not click by mouse (check box)
    should be cleared on the screen when commit/save.
    declare
    begin
    go_block('Bl');
    first_record;
    loop
    if :kcheck is null then
    clear_record;
    else
    Exit When :System.Last_Record = 'TRUE';
    Next_Record;
    end if;
    end loop;
    end;
    it is showing error FRM-40737
    illegal restiricted procedure NEXT_RECORD in pre-insert trigger
    when I used this code in when button press trigger it is working.????
    Message was edited by:
    Kami

    Navigation is not allowed in this kind of triggers.
    PRE-INSERT is used to, for instance, put values on non NULL column in the current record.
    If you want to navigate in the records, choose another trigger, like KEY-COMMIT for example.
    Francois

  • Error with posting period

    Hi All,
    When I am trying to post goods issue
    for material 1 I get the following error log
    Posting only possible in periods 2002/11 and 2002/10 in company code .
    Then,I tried to update posting period using transaction code MMPV BUT INVAIN.
    Please help.
    Regards,

    Hi Neelam,
    1. Go to t.code OB52 there u change the period for your  Code for XXXX
    2.Then go to OX18- remove the Plant and Cocd assisngment(remove all the plants and pls make a note of those plant code later u may need it and save it.
    3.Go to OMSY,here u give the period from and to(whichever period u want to post n to)
    4.Now again go to OX18 (Plant and Cocd assisngment) here u assign the plant to cocd (all the plant which u have removed/disassigned in the step 2. then save it and come back.
    5.Now go to VL02N for Picking and PGI here u can be able to the same.
    Please check and revert back.. if it works
    Reason for doing above mentioned steps :
    As we can't initialize the company code in this case due to the existance of material valuation records, we are required to do this. This should be taken as work around solution for problem posted in this thread. Normally we come across these kind of problems in sand box or testing server environment.
    Once the system is in productive operation, we normally run the period
    closing program once a month at the beginning of a new period. This
    program sets the new period, making it possible to perform goods
    movements with reference to the new period.
    In real time this will be handled by MM consultants as they own this area
    Thanks and Regards,
    Guru

  • BODS Error with IDENTITY INSERT and Transactional Data Loading

    Hi All,
    We are facing some issues while working with SAP BODS,
    Scenario: We have 4 tables in Microsoft SQL Server that contains identity Columns and they bears an Parent-Child Relationship among themselves.
    We need to insert values into the tables simultaneously.
    Solution we are trying to implement:
    a) Trying Transactional Options for each table in the data store – but for that the preloading and post loading SQL tabs are going  disabled
                        So error facing is enable identity_insert  is set to OFF. We have everything enabled in database the user which connects the BODS is the owner of the database.
    b) Trying Bulk Loading Options
                             Bulk Loading is able to insert values into tables, but then where there is a parent child relationship we are facing the error of Foreign-Key.
    Please Share your views.
    Thanks a lot in advance.
    Regards
    Joy

    Yes I have tried that, if we use Transaction Loading then both pre-load and post load options are disabled for that.
    But if we dont use transaction loading we are facing the parent child table loading problem. Foreign Key constraints are violated,
    I have also tried scripting i.e enabling the identity insert before the data-flow begins.
    Thanks and Regards
    Joy

  • Date Format Issue with Pre-Insert trigger

    I have created a form wherein creation_date and last_update_date are columns in a table that needs to be populated with sysdate (in format mm/dd/yyyy hh:mi:ss am) at time of saving.
    In pre-insert triiger, if I assign date as follows , it works:
    :creation_date=sysdate;
    However this creates date in format yyyy/mm/dd.
    I would like to set it in format mm/dd/yyyy hh:mi:ss am.
    How can this be done-I tried using to_date and to_char but wont work.
    Any ideas?

    hi
    u may try this too.
    when-new-form-instance trigger:
    set_application_property(PLSQL_date_FORMAT,'DDMMYYYY HH12:MI:SS');
    set_application_property(BUILTIN_date_FORMAT,'DDMMYYYY HH12:MI:SS');
    forms_ddl('ALTER SESSION SET NLS_date_FORMAT=''DDMMYYYY HH12:MI:SS'''); sarah

  • Handling update operation in Post Insert Trigger

    Hi All
    We are recording all the data that is being updated or inserted into a Table, (say Table A) by inserting into a custom table whenever an insert or update comes in the trigger.Now suppose a user while updating the data in Table A just fetches the record on front end and click on apply directly without making any changes. This causes an update on Base Table and hence causes an insert into our custom table. As this data is of no use to us..
    Is there any way to stop this data being inserted into our table.
    I have came across two solutions till now.Please suggest which could be better in terms of performance
    1) When the user updates any column in base table and trigger fires. We can check the new values of each column(around 50) with their Old values.In case there is a change we will insert the data into custom table else not.
    2)When user updates any column then we are picking all the new values into a record type datatype and same way latest value from custom table.Then performing minus between these two records by making query from dual.
    Please let me know if there could be any other way around..
    Please Note: My base table could have around 200 columns too
    Thanks
    AJ

    Ajay Sharma wrote:
    Hi All
    We are recording all the data that is being updated or inserted into a Table, (say Table A) by inserting into a custom table whenever an insert or update comes in the trigger.Now suppose a user while updating the data in Table A just fetches the record on front end and click on apply directly without making any changes. This causes an update on Base Table and hence causes an insert into our custom table. As this data is of no use to us..
    Is there any way to stop this data being inserted into our table.
    I have came across two solutions till now.Please suggest which could be better in terms of performance
    1) When the user updates any column in base table and trigger fires. We can check the new values of each column(around 50) with their Old values.In case there is a change we will insert the data into custom table else not.
    2)When user updates any column then we are picking all the new values into a record type datatype and same way latest value from custom table.Then performing minus between these two records by making query from dual.
    Please let me know if there could be any other way around..
    Please Note: My base table could have around 200 columns too
    Thanks
    AJOption 3.
    Fix the front end to disallow the operation. That option being submitting an update statement which doesn't actually change any data.

  • Error with Posting..URLRequest

    package
              import flash.events.MouseEvent;
              import flash.net.URLLoader;
              import flash.net.URLRequest;
              import flash.net.URLVariables;
              import flash.net.URLLoaderDataFormat;
              import flash.net.URLRequestMethod;
              import flash.events.Event;
              import com.adobe.serialization.json.JSON;
              import flash.utils.Timer;
              import flash.events.TimerEvent;
              import flash.errors.IOError;
              import flash.events.IOErrorEvent;
              public class Score
                        private var loader : URLLoader = new URLLoader;
                        private var urlreq:URLRequest = new URLRequest("http://western_education/scores/submit");
                            private var urlvars: URLVariables = new URLVariables;
                        private var sessionId:int = 0;
                        private var sendingScore:Boolean = false;
                        public var msg:String = "";
                        public var isSuccessful:Boolean = false;
                        private var timeoutTmr:Timer = new Timer(5000, 0);
                        public function Score(){
                                  loader.dataFormat = URLLoaderDataFormat.TEXT;
                                  urlreq.method = URLRequestMethod.POST;
                                  sessionId = Math.random()*10000000;
                                  timeoutTmr.addEventListener(TimerEvent.TIMER, timeoutTmrListener);
                        public function setSendingScore(val:Boolean){
                                  sendingScore = val;
                        public function getSendingScore(){
                                  return sendingScore;
                        public function sendScore(gameId:int, score:int, knowledgeTokens:int):void{
                                  urlvars.score = score;
                                  urlvars.knowledgeTokens = knowledgeTokens;
                                  urlvars.gameId = gameId;
                                  urlvars.sessionId = sessionId;
                                  urlreq.data = urlvars;
                                  loader.addEventListener(Event.COMPLETE, completed);
                                  loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
                                  loader.load(urlreq);
                                  setSendingScore(true);
                                  timeoutTmr.start();
                        private function onIOError(e:IOErrorEvent){
                                  setSendingScore(false);
                                  msg = "Connection Timed Out.";
                        private function timeoutTmrListener(e:TimerEvent){
                                  setSendingScore(false);
                                  msg = "Connection Timed Out.";
                                  timeoutTmr.stop();
                        public function completed(event:Event): void
                                  try{
                                            var returnData: URLLoader = URLLoader(event.target);
                                            var jsonData:Object= com.adobe.serialization.json.JSON.decode(returnData.data);
                                            msg = jsonData.message;
                                            isSuccessful = ((jsonData.isSuccessful == "true") ? true : false);
                                            sessionId++;
                                            setSendingScore(false);
                                            timeoutTmr.stop();
                                  }catch(e:Error){
                                            msg = e.message;
                                            setSendingScore(false);
                                            timeoutTmr.stop();
    This code works perfectly fine but when I create another class and just change the name of the respective class, but with the same logic, it no longer handles the post properly [and it will return that nothing was posted]..  Even though it's the same URL and code...
    How I stumbled upon this was because I was trying to do a post to another URL but couldn't figure out for the life of me what was failing.  Any help is appreciated.
    Thanks,
    Tim

    Hey kglad,
    My apologies; I figured out the problem which turned out to be stupid.  I didn't have the constructor matching the new name.. :-/
    Welp.  Thanks for helping out though.

  • Error with Posting

    Hi All
    I have a PL account which has no postings in year 2010 - however, when i run the report F.01 - i see the year end brought forward balance appearing in the 01/2010 column..
    Can anyone shed some light as to why this might happen and how we can rectify this - since this is complicating our January month end..
    Thanks much
    Rukshana

    Hi Again
    so i open up year 2009, do the transfer to another PL account and then run the bal carr forward.
    Wil there be any implications in me running the FAGLGVTR - Balance Carryforward again. And i would do it for 31.12.2009 right?
    I will have to run it for the whole company code - will that again raise any issues..
    Thank you
    Rukshana

  • Post insert error

    hi all
    i have a form for sale entry. i want to insert into an another table
    when i save its contents.
    i used a post insert trigger for this.
    but the form has a detail block. and so this insert as many records as this block has.
    the form has the following blocks.
    sal_master(master block)
         sal_id
         sal_date
         cust_id
    sal_detail(detail block)
         sal_id
         qty
         price
    post insert trigger
    declare     
         a number; -- ledger no
         b number; -- customer id
         c date; -- entry date
         d number; -- credit
    begin
         -- insert into customer ledger
         select nvl(max(l_id)+1,1)
         into a
         from cust_led;
         b:= :sal_master.cust_id;
         c:= :sal_master.sal_date;
         d:= :ser_detail.total;
         insert into cust_led (l_id, cust_id, e_date, credit)
         values ( a, b, c, d);
    exception
         when no_data_found then
         raise FORM_TRIGGER_FAILURE;
    END;
    on block level and form level the result is same.
    i want to insert only one entry in the table for multiple records
    in this form.
    MUhammad Nadeem
    marda (pakistan)
    [email protected]

    move this trigger to your sal_master(master block level) . this will only insert 1 record.

Maybe you are looking for