PROMPT Template script for cleaning up corrupt data at seq level 7

DECLARE
   bug_no varchar2(8) := 'CKTEMP07';
BEGIN

  update ck_migration_objects set ci_created = 'N' where ci_stage = 'CKPREMIG' and ci_name = bug_no;

  -- PLACE YOUR SQL CODE TO CLEAN UP CORRUPT DATA HERE
  -- Bug 1384473
  -- ora-1400 cannot insert into des2.i$sdd_atv.low_value 
  -- ora-1400 cannot insert null into des2.i$rm_text_lines.pac_ref 

  for atv in 
  ( 
    select atv.id id 
    from  ci_attribute_values@r212 atv 
    where  low_value is null 
    and    atv.application_system_owned_by in ( select ci_appid 
                                                from ck_migration_objects 
                                                where ci_stage = 'APPSEL' ) 
  ) 
  loop 
    ciiutl.delete_element@r212(atv.id, 'ATV'); 
    
    delete from sdd_elements@r212 
    where el_id = atv.id; 
  
  end loop; 

  update ck_migration_objects set ci_created = 'Y' where ci_stage = 'CKPREMIG' and ci_name = bug_no;
   
  commit;
  
EXCEPTION 
  when others then
     dbms_output.put_line (' ** Exception Raised ** ');
     dbms_output.put_line ('...ERROR: '||substrb(sqlerrm, 1, 200));
     raise;
	 
end;
/
