    where e.Accession = :old.Experiment
    and p.Name = :old.Property
    and pv.Name = :old.Value
-   and t.SamplePVOntologyID = so.SamplePVOntologyID);
+   and t.SamplePVID = so.SamplePVID
+   and t.OntologyTermID = so.OntologyTermID);
  
    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 (AssayPVOntologyID,OntologyTermID, AssayPVID) 
                         VALUES (A2_AssayPVOntology_Seq.nextval,mOntologyTermID_new, t.AssayPVID);
   EXCEPTION
   WHEN NO_DATA_FOUND THEN
    NULL;

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