This discussion is archived
1 Reply Latest reply: Nov 17, 2012 5:15 AM by vansul RSS

WHEN-VALIDATE-TRIGGER trigger looping so many times

584260 Newbie
Currently Being Moderated
Hi,

Below is the code written in WHEN-VALIDATE-TRIGGER trigger and after raise FORM-TRIGGER_FAILURE
the process is not stopping and the trigger message looping without end when
I tab to the next field or try to save the record. I am not sure why the flow did not stop
after the raise FORM_TRIGGER_FAILURE exception and the trigger looping again and again.
Please help me to know what is wrong in the code. This trigger written in ITEM level.
 declare
                 msg_type varchar2(3);
              msg_text varchar2(2000);
              continue       boolean;
            begin
              if :pom1_b22.qty < 0 then
                message_ppkg.get_msg_from_db('RET','04060',msg_type,msg_text);
                message(msg_text || '.');
                bell;
                raise form_trigger_failure;
              else
                continue := TRUE;
                if :pom1_b22.qty is not null and :pom1_b22a.b22_query = 'FALSE' then
                  if nvl(:pom1_b22.irt_created,'N') = 'Y' then
                    if :pom1_b22.qty <> :pom1_b22.save_qty and
                      :pom1_b22.save_qty is not null then                     
                      if check_order_status then
                        continue := TRUE;
                      else
                        continue := FALSE;
                         message_ppkg.get_msg_from_db('RET','04061',msg_type,msg_text);
                         message(msg_text);    
                        bell;
                        :pom1_b22.qty := :pom1_b22.save_qty;
                        raise form_trigger_failure;
                      end if;
                    end if;
                  end if;                 
                  if continue then
                    if :pom1_b22.save_qty is null then
                      if :pom1_b22.qty > :pom1_b22a.total_qty then
                         message_ppkg.get_msg_from_db('RET','04057',msg_type,msg_text);
                         message(msg_text || to_char(:pom1_b22a.total_qty) || '.');    
                        bell;
                        raise form_trigger_failure;
                      end if;
                    else
                      if :pom1_b22.qty <> nvl(:pom1_b22.save_qty,0) then
                        if :pom1_b22.qty > :pom1_b22a.total_qty +
                                           (nvl(:pom1_b22.save_qty,0) -
                                            :pom1_b22.qty) then
                                                message_ppkg.get_msg_from_db('RET','04056',msg_type,msg_text);
                         message(msg_text || to_char(:pom1_b22a.total_qty +
                                          (nvl(:pom1_b22.save_qty,0) -
                                           :pom1_b22.qty)));                  
                          bell;
                          raise form_trigger_failure;
                        end if;
                      end if;
                    end if;
                  end if;
                end if;
              end if;
            end; 

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points