Merge and match oracle

Posted by Dante on Stack Overflow See other posts from Stack Overflow or by Dante
Published on 2011-06-21T20:08:47Z Indexed on 2011/06/22 0:22 UTC
Read the original article Hit count: 415

Filed under:
|
|

I really need some help with my query. I am trying to merge two tables together, but I only want the data were Cast_Date and Sched_Cast_Date are the same. I try to run the query but I get the error missing keyword in the line 21 column 13. I am sure that this is not the only potential error that I have. Could someone help me to get this query up and running? Below is the query that I am running.

merge into Dante5 d5 using (SELECT bbp.subcar treadwell, bbp.BATCH_ID batch_id, bcs.SILICON silicon, bcs.SULPHUR sulphur, bcs.MANGANESE manganese, bcs.PHOSPHORUS phosphorus, bofcs.temperature temperature, to_char(bbp.START_POUR, 'dd-MON-yy hh24:MI') start_pour, to_char(bbp.END_POUR, 'dd-MON-yy hh24:MI') end_pour, to_char(bbp.sched_cast_date, 'dd-mon-yy hh24:mi') Sched_cast_date FROM bof_chem_sample bcs, bof_batch_pour bbp, bof_celox_sample bofcs WHERE bcs.SAMPLE_CODE= to_char('D1') and bofcs.sample_code=bcs.sample_code and bofcs.batch_id=bcs.batch_id and bcs.batch_id = bbp.batch_id and bofcs.temperature>0 AND bbp.START_POUR>=to_DATE('01012011000000','ddMmyyyyHH24MISS') and bbp.sched_cast_date<=sysdate)d3 ON (d3.sched_cast_date=d5.sched_cast_date) when matched then delete where (d5 sched_cast_date>=to_date('18012011','ddmmyyyy')) when not matched then update set d5=batch_id='99999'

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about merge