Subject | Problem in Non Updatateable Views' triggers |
---|---|
Author | Marco Lauria |
Post date | 2002-01-12T17:50:29Z |
Hello All,
I am encountering this problem using non updateable views' with trigger.
I have a V_DOCUMENT_ED
and a V_DOCUMENT_ROWS _ED views
the first one refers to a DOCUMENT table and a "ED" table
while the second deals with a "DOCUMENT_ROWS" table and a "ED_ROWS" table.
I have before insert/update/delete triggers in every one.
Now in one of the triggers of the V_DOCUMENT_ROWS_ED I update
some columns of V_DOCUMENT_ED views.
Everything works perfectly till when I have a reference in a trigger of
"V_DOCUMENT_ED"
to some action against V_DOCUMENT_ROWS_ED.
This can be seen as a circular reference but it isn't.
Infact the triggers of the ROWS view updates the totals on the other view,
while the "V_DOCUMENT_ED" update the "V_DOCUMENT_ROWS_ED" only
when a flag is changed and this can't be changed by the triggers on
"V_DOCUMENT_ROWS_ED".
The problem is that when I create this trigger
CREATE TRIGGER V_DOCUMENT_ED_AU FOR V_DOCUMENT_ED ACTIVE
AFTER UPDATE POSITION 0
AS
BEGIN
if (new.confermato != old.confermato) then
update v_document_rows_ed set confermato = new.confermato where
id_document = new.id_document;
END
I get a "cannot update read-only view V_DOCUMENT_ROWS_ED"
every time I try a "SELECT * FROM V_DOCUMENT_ROWS_ED".
I have also posted a problem with triggers and the floor function,
but no one has answered....
Can someone help me?
Regards
Marco
P.S. I am using Firebird 1.0 RC2
I am encountering this problem using non updateable views' with trigger.
I have a V_DOCUMENT_ED
and a V_DOCUMENT_ROWS _ED views
the first one refers to a DOCUMENT table and a "ED" table
while the second deals with a "DOCUMENT_ROWS" table and a "ED_ROWS" table.
I have before insert/update/delete triggers in every one.
Now in one of the triggers of the V_DOCUMENT_ROWS_ED I update
some columns of V_DOCUMENT_ED views.
Everything works perfectly till when I have a reference in a trigger of
"V_DOCUMENT_ED"
to some action against V_DOCUMENT_ROWS_ED.
This can be seen as a circular reference but it isn't.
Infact the triggers of the ROWS view updates the totals on the other view,
while the "V_DOCUMENT_ED" update the "V_DOCUMENT_ROWS_ED" only
when a flag is changed and this can't be changed by the triggers on
"V_DOCUMENT_ROWS_ED".
The problem is that when I create this trigger
CREATE TRIGGER V_DOCUMENT_ED_AU FOR V_DOCUMENT_ED ACTIVE
AFTER UPDATE POSITION 0
AS
BEGIN
if (new.confermato != old.confermato) then
update v_document_rows_ed set confermato = new.confermato where
id_document = new.id_document;
END
I get a "cannot update read-only view V_DOCUMENT_ROWS_ED"
every time I try a "SELECT * FROM V_DOCUMENT_ROWS_ED".
I have also posted a problem with triggers and the floor function,
but no one has answered....
Can someone help me?
Regards
Marco
P.S. I am using Firebird 1.0 RC2