Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Is relational theory irrelevant?

Re: Is relational theory irrelevant?

From: Serge Rielau <srielau_at_ca.eye-bee-m.com>
Date: Wed, 19 Nov 2003 09:30:49 -0500
Message-ID: <bpfunr$dic$1@hanover.torolab.ibm.com>


The syntax is as follows:
SELECT .. FROM OLD TABLE(DELETE FROM ...) OLD TABLE being the set of deleted rows
For UPDATE you have the choice of OLD TABLE and NEW TABLE (being the set of rows as they are updated (after before triggers, etc...). Consequently INSERT supports NEW TABLE only.

At this point we limit the usage not to include views. This is not because of a problem in the semantics. It's more a problem of accepting that views can MODIFY SQL DATA by simply selsecting from them. Something the standard (and most users I presume) reserve to procedures.
There are some more limits that we imposed since we are ahead of the standard and we need to let it catch up. But those are tactical.

So what you can do is to perform a "relational workflow" where intermediate sets are made persistent on disc by side-effect. People like Paul like that kind of stuff for data cleansing :-) Also you need such concepts in OLTP if you use surrogate keys produced by the DBMS (such as sequences).

Example:
WITH del AS (SELECT * FROM OLD TABLE(DELETE FROM S)) SELECT count(*) FROM NEW TABLE(INSERT INTO T SELECT * FROM del);

I just wiped S and moved the data to T returning the number of rows moved.

Cheers
Serge

-- 
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Received on Wed Nov 19 2003 - 08:30:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US