Sql ORA-38106:在联接视图或具有INSTEAD OF触发器的视图上不支持合并

Sql ORA-38106:在联接视图或具有INSTEAD OF触发器的视图上不支持合并,sql,oracle,select,merge,Sql,Oracle,Select,Merge,如何合并到具有多个表的视图中。 我的问题是,只有当子表、父表连接时,我才能确定要合并的匹配条件,而对于单个表我就不能 我得到了ORA-38106:在连接视图或视图上不支持合并而不是触发器 create table t (id number, c varchar2(10)); create table p (p_id number, id number); merge into (select t.c, p.p_id from t, p where t.id = p.id) t u

如何合并到具有多个表的视图中。 我的问题是,只有当子表、父表连接时,我才能确定要合并的匹配条件,而对于单个表我就不能

我得到了ORA-38106:在连接视图或视图上不支持合并而不是触发器

create table t (id number, c varchar2(10));
create table p (p_id number, id number);

merge into (select t.c, p.p_id from t, p  where t.id = p.id) t 
     using (select 1 id from dual) d 
        ON (t.p_id = d.id) 
      when matched then update set c = 'iii';

使用查询将逻辑移入
。我认为这符合你的意图:

merge into t t 
     using (select p_id from p where p_id = 1) d 
        ON (t.p_id = d.p_id) 
      when matched then update set c = 'iii';

对只是一点零钱。ON(t.id=d.p\U id)应为ON(t.p\U id=d.p\U id)。谢谢