Pre-insert-trigger ignoring assignments

Hi,
I have this code in a PRE-INSERT-TRIGGER of a database table block:
Select emp_seq.Nextval Into :EMP.EMPNO From dual;
Select Sysdate Into :EMP.LASTCHANGED From dual;
And i have this code in a PRE-UPDATE-TRIGGER of the same block:
Select Sysdate Into :EMP.LASTCHANGED From dual;
given scenario:
1) query records from the table into a block:
empno ename lastchanged
1 Smith 01.12.2008
2 Johnson 01.12.2008
2) change empname in any record except no. 1:
empno ename lastchanged
1 Smith 01.12.2008
2 Johannson 01.12.2008
3) create a new record somewhere above the changed record
empno ename lastchanged
1 Smith 01.12.2008
<null> <null> <null>
2 Johannson 01.12.2008
4) insert ename in new record
empno empname lastchanged
1 Smith 01.12.2008
<null> Obama <null>
2 Johannson 01.12.2008
5) do_key('commit_form')
with Forms 6.0.8.23.2 -> working fine
with Forms 6.0.8.27.0 -> ORA-01400:: cannot insert NULL into ("EMP"."EMPNO")
Any assignment in the pre-insert-trigger is ignored! Can anyone help me with this bug? Thanks in advance

message(:EMP.EMPNO) is always Null ...
Everything works if there's no update of a record with higher record-number in the transaction. But the scenario in post 1 doesnt work with Forms 6.0.8.27.0Ugh -- that's ugly!
Unfortunately, opening a Service Request with Oracle will get you nowhere, since Oracle no longer supports Forms 6i.
Yesterday, I experienced something very similar with the same version of Forms, specifically this part: Everything works if there's no update of a record with higher record-number in the transaction.*
If I updated a higher record number in the block, I could NOT get Forms to subsequently store a value in a column in a prior record. I would set the value in the column, and immediately display the value, and it was null! Fortunately in my case, the stored value was only to enable skipping a database lookup in a subsequent pass, so I just skipped working on a solution.
However, in your case, the problem is a show-stopper.
What I found was that if I navigated back to the first record in the block, the problem went away. So maybe try this in your commit process:
    Go_block('ABC');
    First_Record;
    Synchronize;
    Commit_Form;Let us know if that works for you.

Similar Messages

  • Problem with forms6i using Pre-Insert Trigger

    I created a block level pre-insert trigger to do some validations and when I save the first time with wrong data it is working fine and popping up alerts that I defined but if I press save the second time it is saving even though the data is wrong.
    This is in Applications 11.5.10 using all the property classes and running on the server.
    I created exact replica of the form(no applications, property classes
    just basic form but with same functionality) and ran it on my local machine it is working fine. It is giving error till the data is fixed.
    Anybody know why?
    Thanks in advance

    It did not work. It is still doing the samething. Actually it is popping up my alerts but saving the record first time itself. Is there any way I can tell it not to save if the data is wrong. My code is below it basically pops up the alerts but doesn't tell anywhere not to save it.
    Thanks
    VJ
    declare
         v_amount number;
         alert_id      ALERT := Find_Alert('amount_from');
         alert_id1 ALERT := Find_Alert('amount_to');
         dummy_var NUMBER;
    begin
         select max(ssibe_amount_to) into v_amount from ssibe_orderappr_tab where
              ssibe_account_number = :ssibe_orderappr.ssibe_account_number;
              if :ssibe_orderappr.ssibe_amount_from <= v_amount
              then
                   Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, 'Amount_From should be greater than '|| v_amount);
                   dummy_var := Show_Alert(alert_id);
              else
                   IF (:SSIBE_ORDERAPPR.SSIBE_AMOUNT_TO <= :SSIBE_ORDERAPPR.SSIBE_AMOUNT_FROM)
                   THEN
                   dummy_var := Show_Alert(alert_id1);
                   end if;
              end if;
    end;

  • Pre-insert trigger is not firing after post built-in

    Hi,
    I have a 10g form in which Post built-in is used in When-button-pressed Trigger. After the post command I am checking some condition,by using the same record which I have posted.But it is not working.
    I have also put the message in the pre-insert trigger but the message is not displaying.
    But the same form iis working fine in form 6i, as I have migrated the forms from form 6i to 10g.

    Yes, In that block there are other items also. I have made the required property no for all the items.
    what exactly we have is
    (if x=y then)on some condition check
    POST;
    After that, form have a select statement in which it is selecting the same row which is being posted above.
    if the select statement gives count of row zero
    raise form_trigger_failure is fired.
    and in the pre-insert trigger form is assigning a value to a block item.

  • 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

  • Pre-Insert Trigger not firing

    Hi,
    I am using Oracle 10G DS with Oracle 11G XE. I tried PRE-INSERT Trigger with the Code given by Mr Hamid. However, its not working. Though, the WHEN-NEW-ITEM-INSTANCE works fine, I wish to use PRE-INSERT Trigger only.
    Can you please help me.
    My Code is shown below
    BEGIN
    SELECT asset_id_seq.nextval INTO :r_it_blk.asset_id
    FROM dual;
    END;
    Thanks in advance
    Ramesh

    Hi Hamid,
    Thank you very much for your reply.
    I tried at Block Level itself. Further, I also tried the below Code with Cursor (Block Level). Unfortunately, it is also not working. Even the Error Message is also not displayed. The User has full privileges.
    DECLARE
         CURSOR next_id IS SELECT asset_id_seq.NEXTVAL FROM dual;
    BEGIN
         OPEN next_id;
         FETCH next_id INTO :r_it_blk.asset_id;
         CLOSE next_id;
         IF :r_it_blk.asset_id IS NULL THEN
         Message('Error Generating Next Asset ID');
         RAISE Form_Trigger_Failure;
         END IF;
    END;
    Regards
    Ramesh

  • Writing PRE-INSERT trigger in CUSTOM.pll

    Hi,
    We need to write data in a staging table after every save of a Block Data on the eBusiness Center form. How can we achieve this? Can we write PRE-INSERT trigger in CUSTOM.pll.
    Thanks for helping,
    Regards,
    Viral

    Hi. Thanks for the reply. I was trying with Workflow Based Business Events. I am not sure how can I achieve the same with it.
    I was thinking of doing the same using ALERTs. But, I think that is not Oracle suggestable method of doing it? If at all I am going to use the ALERTs than will it be real time?
    Thanks for replying,
    Regards,
    Viral.
    Message was edited by:
    Viral

  • PAYMENT 처리시 PRE-INSERT TRIGGER (VALUE_ERROR)

    제품 : FIN_AP
    작성날짜 : 2005-05-10
    11.0.3 - PAYMENT 처리시 PRE-INSERT TRIGGER (VALUE_ERROR)
    ==============================================
    PURPOSE
    Problem Description
    Payment 화면에서 특정 Invoice 선택 후 저장 시 아래와 같은 Error Message 가 발생함.
    Payment 화면에서 Invoice 선택 후 저장 시 FRM-40735 PRE-INSERT TRIGGER ERROR 가 발생함.
    Workaround
    해당 Form Version이 110.83 이전 Version일 경우 아래와 같이 Code fix 한다.
    1. Payment Form Source File (APXPAWKB.fmb)는 backup 받아 놓습니다.
    2. Oracle Forms 에서 해당 Form Source File 을 열어 아래 부분을 수정 합니다.
    'ADJ_INV_PAY_PROC_INSERT' package 의 'SUB_PRE_INSERT' procedure 를 찾아 l_inv_remit_to 의 length를 80 으로 수정 합니다.
    Example)
    ->수정 전
    procedure SUB_PRE_INSERT is
    l_withhold_amount NUMBER;
    l_awt_success VARCHAR2(2000);
    l_pipe_name          VARCHAR2(2000);
    l_inv_remit_to     VARCHAR2(25); --> 변경 해야 할 부분
    ->수정 후
    procedure SUB_PRE_INSERT is
    return_value VARCHAR2(30);
    l_withhold_amount NUMBER;
    l_awt_success VARCHAR2(2000);
    l_pipe_name          VARCHAR2(2000);
    l_inv_remit_to     VARCHAR2(80);
    3. 위와 같이 수정 후 해당 Form Source 를 Compile 하고 Generate 합니다.
    4. 다시 해당 Payment에 대해서 Invoice 를 Apply 해서 Error 가 발생하는지 여부를 확인 합니다.
    Solution Description
    11.0.3 AP D Patchset 이상을 적용한다.
    Reference Documents
    Bug 921350

    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

  • Forms 9i & pre-insert trigger

    Hi everyone,
    We've just upgraded from Forms 6 to 9i.
    My pre-insert trigger in 9i doesn't seem to be firing - is this something that has changed?
    I need to set my unique ID's and other variables - is there a better place to do this now?
    Please advise.
    Thanks.
    Lesley

    No commit form has not changed.
    The change in behavior that you are probably hitting is where required items really are required even if they are not displayed - this change came in a patch to 6i.
    So I'm guessing that you have a key field which is required but not displayed to the user and you're populating a new key in pre-insert.
    Because you've made the field required, the commit is failing before you actually get to pre-insert because a required field is not filled in.
    So your solution would be to restore the code to Pre-Insert where it belongs and make sure that any non-displayed items are not marked as required.
    Support have a Forms API program that can make this change on-mass for you if you have a lot of forms like this,

  • 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

  • PRE-INSERT TRIGGER

    Dear All,
    In my pre-insert block Level triiger. I have the followed code.
    declare
    l_cnt pls_integer;
    cursor c1 is
    select count(1) into l_cnt
    from jnpp_barcode_master
    where organization_id = :ctrl_blk.inv_org_id
    and item_id = :jnpp_grv_lines.item_id
    and bar_code = :jnpp_grv_lines.bar_code
    and publication_date= :jnpp_grv_lines.publication_date;
    begin
         for r1 in c1 loop
              if l_cnt = 1 then
                   insert into jnpp_barcode_archive
                   (organization_id, item_id, bar_code, publication_date, po_list_price,
    selling_price, received_qty, reference, created_by, creation_date,
    last_updated_by, last_update_date)
    values (:ctrl_blk.inv_org_id, :jnpp_grv_lines.item_id, :jnpp_grv_lines.bar_code, :jnpp_grv_lines.publication_date, :jnpp_grv_lines.po_list_price,
    :jnpp_grv_lines.selling_price, :jnpp_grv_lines.qty, :jnpp_grv_lines.REFERNCE, :GLOBAL.X_USER_ID, sysdate,
    :GLOBAL.X_USER_ID, sysdate);          
              elsif l_cnt = 0 then
                        update jnpp_barcode_master
                        set publication_date = :jnpp_grv_lines.publication_date,reference =:jnpp_grv_lines.refernce
         where organization_id = :ctrl_blk.inv_org_id
         and item_id = :jnpp_grv_lines.item_id
         and bar_code = :jnpp_grv_lines.bar_code;
    end if;      
         end loop;
    forms_ddl('COMMIT');
    end;
    it is encountered the symbol 'INTO'.
    Im using forms 6i.
    please any one can help me.
    Thanks
    Siva

    declare
    l_cnt pls_integer;
    cursor c1 is
    select count(1) into l_cnt
    from jnpp_barcode_master
    where organization_id = :ctrl_blk.inv_org_id
    and item_id = :jnpp_grv_lines.item_id
    and bar_code = :jnpp_grv_lines.bar_code
    and publication_date= :jnpp_grv_lines.publication_date;
    begin
         for r1 in c1 loop
              if l_cnt = 1 then
                   insert into jnpp_barcode_archive
                   (organization_id, item_id, bar_code, publication_date, po_list_price,
    selling_price, received_qty, reference, created_by, creation_date,
    last_updated_by, last_update_date)
    values (:ctrl_blk.inv_org_id, :jnpp_grv_lines.item_id, :jnpp_grv_lines.bar_code, :jnpp_grv_lines.publication_date, :jnpp_grv_lines.po_list_price,
    :jnpp_grv_lines.selling_price, :jnpp_grv_lines.qty, :jnpp_grv_lines.REFERNCE, :GLOBAL.X_USER_ID, sysdate,
    :GLOBAL.X_USER_ID, sysdate);          
              elsif l_cnt = 0 then
                        update jnpp_barcode_master
                        set publication_date = :jnpp_grv_lines.publication_date,reference =:jnpp_grv_lines.refernce
         where organization_id = :ctrl_blk.inv_org_id
         and item_id = :jnpp_grv_lines.item_id
         and bar_code = :jnpp_grv_lines.bar_code;
    end if;      
         end loop;
    forms_ddl('COMMIT');
    end;
    --

  • Is there a pre insert trigger type function

    I have a bc4j application with master-detail view form.
    before or on committing a new record by clicking the junavigation bar button in the detail, is it possible to call a function to set a date value equal to system date? or is there another way to do this ? this field is not displayed in the detail view on the form.i don't want to create a db trigger to do this.
    Thanks in advance,
    Carl.

    Hi Yvonnne,
    Thanks for replying to my question!
    I'm using JDev 9.0.3 and my project is using JClient with bc4j. & JDK 1.4.2
    I'm trying to enable the JAAS login feature, so I can also
    log who creates and amends records.
    If jbo.security.enforce is set to "Test" it works fine.
    When it is set to "Must" ,jdev gives errors,only parts of which I'll display at the end here,(because there are too many lines).It is probably because I havent properly set up a user using the jazn file,but even tho,I should be able to log in as SCOTT/TIGER or USER/456 as it says in the help file,but even so, that gives the same errors.
    Thanks for your help again !
    Here are some lines of the errors JDev prints:
    oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.common.ampool.ApplicationPoolException, msg=JBO-30003: The application pool (Mypackage1ModuleLocal) failed to checkout an application module due to the following exception:
         at oracle.jbo.client.Configuration.createRootApplicationModuleFromConfig(Configuration.java:1144)
         at oracle.jbo.uicli.mom.JUMetaObjectManager.createApplicationObject(JUMetaObjectManager.java:386)
         at mypackage4.FormView1View1_1.main(FormView1View1_1.java:378)
    ## Detail 0 ##
    ## Detail 0 ##
    JBO-30003: The application pool (Mypackage1ModuleLocal) failed to checkout an application module due to the following exception:
    oracle.jbo.JboException: JBO-25222: Unable to create application module.
    ----- LEVEL 3: DETAIL 0 -----
    javax.naming.NamingException [Root exception is java.lang.reflect.InvocationTargetException]
    Caused by: oracle.jbo.JboException: JBO-33021: Failed authenticate user bms
         at oracle.jbo.common.UserAznUtil.authenticateUser(UserAznUtil.java:53)
         at oracle.jbo.common.JboInitialContext.<init>(JboInitialContext.java:63)
         at oracle.jbo.server.InitialContextImpl.<init>(InitialContextImpl.java:36)
         ... 21 more

  • Sequence number in pre-insert form trigger

    i have two tables invoice (master) inv_detail(detail) and assign the invoice number using a sequence number,
    by writing the folowing code in the pre-insert trigger
    select a.nextval into :inv_no from dual;
    ( i make the trigger at the form level becuause i have a master (invoice) and detail (inv_detail) relation at the same screen,so i must fetch the value of the
    sequence into the :invo_no in the screen,to let the 'copy value from' property at the detail block works so the value of the foreign key will be copied from
    the sequence number at the screen.
    will this method be a good one for multi user envirment(to select the a.nextval in the pre-insert trigger at the from level?)

    Kevin, thank you for the correct explanation. I was making an assumption and of course it was wrong.
    Mohannad, please do not try to link the invoice count with the sequence number. Any time you need a count, just do a select count(*). The sequence number is ONLY a unique key, and should represent nothing else.
    People have discussed this situation heavily. If you insist on trying to ensure there are no gaps, you will:
    1. Fail -- there are many scenarios where gaps will occur.
    2. Waste your time.
    3. Whatever process you build to try to prevent gaps will cause unnecessary overhead and work for the server, and in a multi-user environment, cause processing bottlenecks due to table locks.

  • Unable to insert the record to table using pre-insert & pre-update trigger

    Hi All,
    I have tried to insert and update the backend table using the pre-update and pre-insert triggers. But its not working for me. Please find below the code which i have used in the triggers.
    Pre-insert trigger:
    DECLARE
    v_cust_num_cnt NUMBER;
    BEGIN
              SELECT      COUNT(customer_number)
              INTO      v_cust_num_cnt
              FROM cmw_bc_mobile_number
              WHERE substr(customer_number,1,15)=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              IF      v_cust_num_cnt = 0 THEN
                        INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER
                                                                                                   ,MOBILE_NUMBER
    ,CREATION_DATE
    VALUES
    (substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15)
    ,:BLOCKNAME.MOBILE_NUMBER
    ,SYSDATE
    COMMIT;                                                                                                    
    END IF;          
    END;
    PRE_UPDATE TRIGGER:
    BEGIN
              IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
              UPDATE apps.cmw_bc_mobile_number
         SET mobile_number = :BLOCKNAME.MOBILE_NUMBER,
         creation_date = SYSDATE
              WHERE customer_number=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
              COMMIT;
         END IF;
    EXCEPTION
              WHEN OTHERS THEN
                   NULL;     
    END;
    Please let someone assist in gettting it resolved.
    Regards,
    Raj.

    Just use MESSAGE (we don't know what fnd_message is, that is some custom code):
    message('v_cust_num_cnt='||v_cust_num_cnt);
    IF v_cust_num_cnt = 0 THEN
      message('Now inserting...');
      INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER... 
    else
      message('Nothing to insert');
    end if;

  • MAX + 1 Pre Insert

    Dear All
    i need to use MAX+1 instead of Sequence value in Pre Insert trigger in ADF / JSF Application ..
    and this value assigned to PK Attribute
    i unchecked Mandatory value for PK
    my problem now, system give me the value is required when i try to enter second record without commit first record as i have af:table , and i guess that it read the validation before pre insert trigger in dodml
    if (operation == DML_INSERT) {
    setContractId(GetSequenceValue("customers", "customer_id"));
    thanks
    Edited by: user8854969 on Dec 13, 2012 11:42 PM

    Tell your client to ignore the gaps...
    If you want a gapless number, you have 2 basic options:
    1). Assign the gapless number in a batch process after-the-fact
    2). Use an approach that serialises (i.e. only allows one insert at a time), by using locking or some other serialisation method. This approach limits your scalability.
    I have (almost always) used option 3: Use a sequence and ignore the fact that there are gaps. I the case where I didn't use this option, I used approach 2. You cannot do this with a trigger!
    John

  • Post-insert vs pre-insert

    Dear All,
    can anybody explain the difference b/w pre-insert and post-insert trigger ?
    i need such example which process something that becomes possible in one trigger and no possible in other ?
    Regards
    Kashif Butt

    Here is an example. Please remove any syntax errors before running :-)
    create sequence my_seq;
    create table table_a
    (id number(20) constraint pk_table_a primary key,
    text varchar2(100)
    create table table_b
    (id number(20) constraint pk_table_b primary key,
    a_id number(20) constraint fk1_table_b foreign key references table_a(id),
    text varchar2(100)
    Create a form with a block based on table_a with items "id" and "text"
    "id" is on null canvas (not visible), put "text" on a canvas.
    pre-insert:
    select my_seq.nextval into :table_a.id;
    This can't be done in post-insert. Then the insert will fail because it's the primary key and must be "not null"
    post-insert:
    insert into table_b(id, a_id, text)
    values(my_seq.nextval, :table_a.id, 'Inserted automatically by post-insert');
    This can't be done in the pre-insert trigger, because the foreign key constraint will require the record in table_a
    to be inserted first.

Maybe you are looking for

  • Is Exchange 2010 supported on Windows Server 2012 R2?

    According to the  Understanding Exchange 2007 upgrade prerequisites, https://technet.microsoft.com/en-US/Library/ee958305 these are the supported windows operating systems 64-bit edition of Windows Server 2008 Standard Service Pack 2 64-bit edition o

  • How to clear invoices with different house banks

    Hi, i have posted 3 invoices to one vendor now i want to clear 2 invoices from one house bank ( citi bank) and 1 invoice from another house bbank (abn amro ) how can i make settings in fbzp ? thanks inadvance for ur answer points wil b assigned Regar

  • Screen programming - Return statement

    Hi, In the middle of a user exit, I have called a screen in which two buttons are there "SAVE and Exit". If save button is pressed, data should update the value is table and  continue with the user exit. If exit button is pressed, nothing should happ

  • IPhone Photo's

    Hi, I have an iPhone and have synced 619 photos to the phone, they are only small images. In iphoto all 619 photos only take up 21mb of space but, when synced to phone they take up over 400mb, can someone please explain why this is? Also when viewing

  • How to create value table

    hi to all,         how to create value table and provide clear document Thanks&Regards M.Suresh Moderator message: please search for available information/documentation. Edited by: Thomas Zloch on Jun 14, 2011 1:19 PM