I don't quite get your logic, but here is a first draft of something that might be close to what you want. You will need to fill in the details and test.
Code:Create OR Replace Procedure auditingsp( pi_bcode IN Varchar2 ) AS TYPE acfg_tab IS TABLE OF aud_cur%Rowtype; acfg_array acfg_tab; BEGIN SELECT id, v_YN, mand, bcode, skey, i_o, tname, cname, func, group_col1, group_col2, group_col3, message_id, wheresql, message BULK COLLECT INTO acfg_array FROM acfg INNER JOIN table1 ON WHERE mand = pi_mand AND pi_I_O IN ('I', 'O') AND bcode=pi_bcode; FOR i IN acfg_array.FIRST..acfg_array.LAST LOOP IF upper(acfg_array(i).v_yn) = 'Y' and pi_I_O = 'I' THEN INSERT INTO auditing ( ID, cdate, ccode, pid, mand, skey, Source, message ) VALUES ( audseq.Nextval, SYSDATE, i.bcode, i.pid, i.mand, i.skey, i.Source, i.country ) ELSE dbms_output.put_line('Data is ignored'); END IF; END LOOP; COMMIT; END auditingsp; /




Reply With Quote