Lets say I have something like the following:
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
);
I want
insert into source_1 values ( 'hello' );
to insert ( 'hello', 1 )
into tab
.
And similarly:
insert into source_2 values ( 'hello' );
to insert ( 'hello', 2 )
into tab
.
I know I could use default values on the table if there was only one view, but that won't work for two views.
Is there anyway to do this other than instead of insert
triggers on each of the views?
No, this is still a view and not a table. Views do not support default values as they are logical entities and not physical ones like tables.