Re: Extending my question. Was: The relational model and relational algebra - why did SQL become the industry standard?

From: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Tue, 25 Feb 2003 10:26:40 -0800
Message-ID: <3FO6a.7$Ih6.66_at_news.oracle.com>


"Paul Vernon" <paul.vernon_at_ukk.ibmm.comm> wrote in message news:b3fuvn$18g2$1_at_sp15at20.hursley.ibm.com...
> "Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message
> news:rIu6a.8$i82.99_at_news.oracle.com...
> > "Paul Vernon" <paul.vernon_at_ukk.ibmm.comm> wrote in message
> > news:b32jok$19em$1_at_sp15at20.hursley.ibm.com...
> > > FYI In DB2 we can insert into UNION views, but it's strictly a one
tuple
> > in
> > > the view to one tuple in one table affair. I could use INSTEAD OF
> > triggers,
> > > but to map the two inserts into one could still be difficult.
> >
> > Or, is it even possible?
>
> CREATE TRIGGER phonI INSTEAD OF INSERT ON phonesV
> REFERENCING NEW_TABLE AS nt
> FOR EACH ROW MODE DB2SQL
> BEGIN ATOMIC
> SELECT v.id, v.number as voice, f.number as fax
> FROM nt V, nt F
> WHERE V.id = F.id
> AND V.phonetype = 'VOICE'
> AND F.phonetype = 'FAX'
> EXCEPT SELECT * FROM contacts;
> END
Simple indeed: just put the inverse view, which is applied to the view content increment, into the INSTEAD_OF trigger body.

My confusion: there is actually no such a problem of coordinatively translating 2 view inserts into one base table insert. A selfjoin takes care of it. On the first record insert nothing happens, while at the second insertion view delta is translated into the base table insert. FOR EACH ROW event trigger is adequate. Cool. Received on Tue Feb 25 2003 - 19:26:40 CET

Original text of this message