    where e.Accession = :old.Experiment
    and p.Name = :old.Property
    and pv.Name = :old.Value
-   and t.AssayPVONtologyID = ao.AssayPVOntologyID);
+   and t.assayPVID = ao.assayPVID
+   and t.OntologyTermID = ao.OntologyTermID);
   
   else --new ontology term is not 
    dbms_output.put_line('update assay and sample mapping'); 

   where e.Accession = :old.Experiment
   and p.Name = :old.Property
   and pv.Name = :old.Value
   and t.SamplePVOntologyID = so.SamplePVOntologyID);
 
   delete a2_assaypvontology t
   where exists(select 1 

                                             where e.accession = :new.Experiment
                                             and apv.PropertyValueID = mPropertyValueID_new) t
   ON (apvo.AssayPVID = t.AssayPVID and apvo.OntologyTermID = mOntologyTermID_new)
   WHEN NOT MATCHED THEN INSERT (OntologyTermID, AssayPVID)
                         VALUES (mOntologyTermID_new, t.AssayPVID);
   EXCEPTION
   WHEN NO_DATA_FOUND THEN
    NULL;
