ORA-00905:在sql中合并期间缺少关键字

ORA-00905:在sql中合并期间缺少关键字,sql,oracle,Sql,Oracle,下午好 这句话很管用 merge into temp using(select * from emp where deptno=10) s on (temp.empno=s.empno) when matched then update set temp.sal=s.sal*0.1 where sal > 300 when not matched then insert (temp.ename,temp.sal )values (s.ename,s.sal*0.1) where (s.sa

下午好

这句话很管用

merge into temp using(select * from emp where deptno=10) s on (temp.empno=s.empno)
when matched then update set temp.sal=s.sal*0.1 where sal > 300
when not matched then insert (temp.ename,temp.sal )values (s.ename,s.sal*0.1) where (s.sal<300);
我用类似于emp表的结构创建了temp

谁能帮帮我吗。我想使用merge命令将emp表的内容复制到temp表
中,其中deptno=10

merge into temp target 
using (select * from emp where deptno=10) source on (target.empid = source.empid)
when matched then update set target.sal=source.sal*0.1;
不能将ON(1=1)与MERGE一起使用,因为MERGE是确定性的

MERGE是一个确定性语句。您不能更新同一行的 在同一MERGE语句中多次删除目标表


然而,对于insert来说,情况并非如此。例如,您可以使用ON(1=0)插入您想要的任何内容。

在合并条款中必须使用UPDATE或insert,但这是我在oracle文档中将[hint]合并到[schema.]{table | view}[t|u alias]时使用[schema.]{table | view | subquery}[t| alias]的语法(条件)[merge_update_子句][merge_insert_子句][error_LOGING_子句];其中update或insert是选项…..我不确定如果我错了,请纠正我Oracle参考中有一个小提示:“注意:您必须指定至少一个子句merge_update_子句或merge_insert_子句”。您在上做什么(1=1)?根据合并语法,它始终为true,因此您要更新。更新什么?我要用emp表中deptno为10的所有行更新temp表
merge into temp target 
using (select * from emp where deptno=10) source on (target.empid = source.empid)
when matched then update set target.sal=source.sal*0.1;