|Subject||Re: View updates and upward compatibility|
> Oracle puts the clause on the trigger definition, saying that thisIt is a while since I've looked at this, but my recollection of
> trigger replaces natural updates for its view. I'd rather see it
> on the view. Something like TRIGGER_UPDATE_ONLY.
Oracle's way of doing it is:
- On tables you can specify BEFORE and AFTER triggers
- On views you can specify INSTEAD OF triggers
- BEFORE and AFTER won't work with views
- INSTEAD OF won't work with tables
- Some views can be updated. If an updateable view has
a trigger (which must be of type INSTEAD OF), 'natural'
update is disabled/foregone
The above sounds like a logical and sound design to me. Also, it
seems to be compatible with the rules that Dmitry put forward (see
Ann's earlier post).
However, I can see the point that there shouldn't be much difference
between updating a table and a 'simple' view of that table. Perhaps
we should not signal that natural update is switched off, but signal
that it should be switched on. Something like:
CREATE [UPDATEABLE] VIEW ...
If the view definition is not updateable this should throw an error
at DDL time. If it is, it signals that the view should be treated
like a table when it comes to working with triggers.