shy_
Дата: 12.12.2007 01:05:50
Здравствуйте. Очень сильно мучает следующий вопрос.
Есть две таблицы:
create table Acc_Tran
(
Op_Day date not null
check (trunc(Op_Day)=Op_Day),
Op_Nr number(4) not null
check (Op_Nr >= 1),
Note varchar(4000),
Posted_Mark number(1)
check (Posted_Mark = 1),
primary key (Op_Day, Op_Nr)
)
/
create table Acc_Tran_Entry
(
Op_Day date not null,
Op_Nr number(4) not null,
Entry_Nr number(2) not null,
Acnt varchar(12) not null,
Amount_DB number(12,2)
check (Amount_DB != 0),
Amount_CR number(12,2)
check (Amount_CR != 0),
foreign key (Op_Day, Op_Nr) references Acc_Tran,
primary key (Op_Day, Op_Nr, Entry_Nr),
check (Amount_DB is not null and Amount_CR is null or Amount_DB is null and Amount_CR is not null)
)
/
Есть представление
create view Acc_Draft_Trans
as
select Op_Day, Op_Nr,
count(distinct Acnt) as Acnt_Count,
Note
from Acc_Tran
natural join Acc_Tran_Entry
where Posted_Mark is null
group by Op_Day, Op_Nr, Note
/
Задача: сделать его обновляемым. Как?
SimonInBlues
Дата: 12.12.2007 22:23:30
автор |
Без использования тригера |
иначе нельзя
RTFM Update
If you specify view, then the database updates the base table of the view. You
cannot update a view except with INSTEAD OF triggers if the defining query of the
view contains one of the following constructs:
A set operator
A DISTINCT operator
An aggregate or analytic function
A GROUP BY, ORDER BY, MODEL, CONNECT BY, or START WITH clause
A collection expression in a SELECT list
A subquery in a SELECT list
A subquery designated WITH READ ONLY