PL/SQL problem: Unecessary insert in table

From: Tom Henricksen <thenricksen_at_ciscoinc.com>
Date: 2000/06/20
Message-ID: <394f810f.0_at_news>#1/1


[Quoted] This key-commit trigger is adding data after the third line. When the delete occurs I can check the database and there is two rows of data. Then when it get to the insert in user_lbl the correct data is input. This makes no sense, i have two rows of incorrect data for every correct row. Thanks,
Tom

begin
 message('Key-commit');
  delete iac.w_clause;
  message('after delete');
  /* unecesary insert here */
 commit;
  if :var_lbl.fld_nam is not null then
   commit;
   go_record(1);
   loop
    select dba_nam,tab_nam,d_type into :global.dba_nam, :global.tab_nam, :global.d_type

    from iac.var_lbl
    where var_lbl.fld_nam = :var_lbl.fld_nam;     insert into iac.w_clause values(:global.dba_nam,:var_lbl.start_val     ,:var_lbl.end_val,:global.tab_nam,:global.d_type);    message('insert w_clause '||:global.dba_nam||' '||:var_lbl.start_val||'
'||:var_lbl.end_val||' '||:global.tab_nam);

    if :global.flag = 1 then

     --message(':global.flag '||:global.flag);
      if :user_lbl.lbl_nam is not null then
       --message(':user_lbl.lbl_nam '||:user_lbl.lbl_nam);
       /* added 06-19-2000 to fix unecessary inserting TH*/
        insert into iac.user_lbl values(:user_lbl.lbl_nam,:var_lbl.fld_nam

,:var_lbl.start_val,:var_lbl.end_val,:order_lbl.fld_nam,:user_lbl.lbl_num);
     message('insert user_lbl '||:global.dba_nam||' '||:var_lbl.start_val||'

'||:var_lbl.end_val||' '||:global.tab_nam);
end if;

    end if;
    if :SYSTEM.LAST_RECORD = 'TRUE' then       exit;
    end if;
    next_record;
   end loop;
   commit;
 end if;
  :global.flag := 0;
 go_block('order_lbl');
exception
  when no_data_found then
   message('FIELD IS NOT AVAILABLE');
end; Received on Tue Jun 20 2000 - 00:00:00 CEST

Original text of this message