The trick we will use to make
DML possible consists
of three steps:
- Define a view on the external table.
- On this view, define
INSTEAD OF
triggers for insert, update and delete.
- Write PL/SQL code in these triggers
to perform the required processing.
Kok then shows examples of the code and offers a
free download of his technique, and offers
important caveats:
The problem is with doing a multiple
delete (i.e. a delete statement that affects
more than one row). As we noted before, the
INSTEAD OF trigger is implicitly for each row.
This means statement-level information is
unavailable.
create or
replace view emp_ext_tab_vw
as
select rownum
rownumber
, emp.empno
empno
, emp.ename
ename
, emp.job
job
, emp.mgr
mgr
, emp.hiredate
hiredate
, emp.sal
sal
, emp.comm
comm
, emp.deptno
deptno
from emp_ext_tab
emp
order by rownumber asc
/
create or replace trigger emp_ext_tab_vw_brd
instead of delete on emp_ext_tab_vw
begin
--
emp_ext_tab_dml.delete_record ( :OLD.rownumber );
--
end;
/