Search code examples
oracle-databaseoracle10goracleforms

not inserting data into tables with form trigger failure


I put a code on key next item which work partly I don't know why please help me if anyone knows about this using form 10g with oracle database 11g code is this

IF
     :BUNDLE_NUM = :USER_ID
        THEN INSERT INTO 
         PROD_CUT_ISSU_DTL
         (TRANS_ID,TRNAS_DET_ID,ORDER_NUM,ARTICLE_ID,QTY,PROD_OPEN_ID,OPER_CODE)
         VALUES
         (:PAY_IN_OUT.ISS_T_ID, :PAY_IN_OUT.ISS_TRNAS_DET_ID, A,
         B, :PROD_STCH_PROD_EMP_DET.ISS_TOT, 1 , :PROD_STCH_PROD_EMP_DET.OPER_CODE);
         
        RAISE FORM_TRIGGER_FAILURE;     
        GO_ITEM('PAY_IN_OUT.USER_ID');
        CLEAR_FORM(NO_VALIDATE);
END IF;

works fine when doing separate separate portion like if I run only this code it will work

IF
     :BUNDLE_NUM = :USER_ID
        THEN INSERT INTO 
         PROD_CUT_ISSU_DTL
         (TRANS_ID,TRNAS_DET_ID,ORDER_NUM,ARTICLE_ID,QTY,PROD_OPEN_ID,OPER_CODE)
         VALUES
         (:PAY_IN_OUT.ISS_T_ID, :PAY_IN_OUT.ISS_TRNAS_DET_ID, A,
         B, :PROD_STCH_PROD_EMP_DET.ISS_TOT, 1 , :PROD_STCH_PROD_EMP_DET.OPER_CODE);
END IF;

Or just run this code its working

IF
     :BUNDLE_NUM = :USER_ID
        THEN
        RAISE FORM_TRIGGER_FAILURE;     
        GO_ITEM('PAY_IN_OUT.USER_ID');
        CLEAR_FORM(NO_VALIDATE);
END IF;

Please if any one know where I am doing wrong please correct me Respects


Solution

  • This

    RAISE FORM_TRIGGER_FAILURE; 
    

    looks terribly wrong. Basically, you're doing something (inserting a row) and then immediately raise an error. That just won't work.

    Raise an error when you want to prevent something to happen (e.g. in exception handling section).

    I suggest you remove it.


    Also, note that KEY-NEXT-ITEM won't work if someone navigates through the form using a mouse.