Oracle中可更新视图的默认值

时间:2011-11-16 04:07:14

标签: sql oracle updatable-views

假设我有以下内容:

create table tab
(
  data varchar2(100),
  source number
);

create view source_1 as
(
  select data from tab where source = 1
);

create view source_2 as
(
  select data from tab where source = 2
);

我想要

insert into source_1 values ( 'hello' );

( 'hello', 1 )插入tab

同样地:

insert into source_2 values ( 'hello' );

( 'hello', 2 )插入tab

我知道如果只有一个视图,我可以在表上使用默认值,但这对两个视图不起作用。

除了每个视图上的instead of insert触发器之外,还有其他方法吗?

1 个答案:

答案 0 :(得分:2)

不,这仍然是一个观点,而不是一张桌子。视图不支持默认值,因为它们是逻辑实体,而不是像表格那样的物理实体。

相关问题