                                              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);
+   WHEN NOT MATCHED THEN INSERT (OntologyTermID, AssayPVID)
+                         VALUES (mOntologyTermID_new, t.AssayPVID);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
     NULL;

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

                                              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;
