title: making oracle merge insert or update faster
body: <p>I am running through a list one by one and merging the data from that list based on a long list of conditions into a different table.</p>
  
  <p>The merge does an insert when not matched, update when matched. I find this merge to be taking a lot of time. </p>
  
  <p>It takes me 10seconds to run through a list of 200 records which seems excessive. Is there a way to make this merge faster please? Thank You</p>
  
  <pre><code>stmt := 'MERGE INTO dash_'||domain_name||'_rag TARGETd USING (SELECT '||''''||ms||''''||' AS JNDI, '||''''||domain_name||''''||' AS DOMAIN, ''Y'' AS TARGET, '||''''||jndi_type||''''||' AS JNDI_TYPE, '||''''||jndi_s||''''||' AS MS2_D1, '||''''||RAGr||''''||' AS MS2_D1R, '||'SYSDATE AS TS FROM DUAL) SOURCE ON (SOURCE.JNDI=TARGETd.JNDI) WHEN NOT MATCHED THEN INSERT (JNDI, DOMAIN, TARGET, JNDI_TYPE,MS2_D1, MS2_D1R, TS) VALUES(SOURCE.JNDI, SOURCE.DOMAIN, SOURCE.TARGET, SOURCE.JNDI_TYPE,SOURCE.MS2_D1, SOURCE.MS2_D1R, SOURCE.TS)WHEN MATCHED THEN UPDATE SET TARGETd.TARGET = SOURCE.TARGET, TARGETd.MS2_D1=SOURCE.MS2_D1, TARGETd.MS2_D1R=SOURCE.MS2_D1R, TARGETd.TS=SOURCE.TS';
  
        execute immediate stmt;
  </code></pre>