You need the Oracle Rdb READ and ERASE privileges to the relation
and the Oracle Rdb ERASE privilege to the database to use the ERASE
statement.
You cannot erase records from a view that was formed with one of
the following clauses:
o WITH clause of an RDO record selection expression
o REDUCED TO clause of an RDO record selection expression
o CROSS clause of an RDO record selection expression
o UNION clause of an SQL select expression
Prior to Version 4.1, Oracle Rdb allowed you to erase rows from a
table that was directly joined with other tables. Beginning with
Version 4.1, Oracle Rdb returns an error message if you try to erase
a row under these conditions. For example, Oracle Rdb will return
the error, $RDMS-E-JOIN_CTX_UPD, relation EMPLOYEES is part of
a join, cannot be updated, when you try to execute the following
query:
FOR E IN EMPLOYEES CROSS D IN DEGREES OVER EMPLOYEE_ID
WITH D.DEGREE= 'MA'
ERASE E
END_FOR
In the preceding query, if an employee has two MA degrees, the
same employee row will be joined to two different degree rows.
Therefore, Oracle Rdb will try to delete the same row twice. The
previous update query can be reworded into an equivalent form to
achieve the desired results as follows:
FOR E IN EMPLOYEES WITH
(ANY D IN DEGREES WITH D.EMPLOYEE_ID = E.EMPLOYEE_ID)
ERASE E
END_FOR
The rows can now be erased because the EMPLOYEES table is no
longer directly joined to the DEGREES table. The use of this
query guarantees that an employee row will not be deleted more
than once.
Note that some examples in the Guide to Using RDO, RDBPRE, and
RDML will no longer work with the update rules created in Oracle Rdb
Version 4.1. To run these examples, rewrite them using the ANY
subquery mentioned previously.