合并和匹配oracle

| 我的查询确实需要一些帮助。我试图将两个表合并在一起,但是我只希望数据分别为Cast_Date和Sched_Cast_Date相同。我尝试运行查询,但在第21行的第13列中得到了error missing关键字。我确信这不是我唯一的潜在错误。有人可以帮助我启动并运行此查询吗?下面是我正在运行的查询。
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\'
    
已邀请:
        开头的语法无效。如果指定“匹配时”,则需要指定“匹配时然后更新集” col = value。对于“未匹配时”,您必须指定“未匹配时然后插入”。有关更多信息,请参见文档。     

要回复问题请先登录注册