Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Modifying a constraint to make exceptions...
I beleive you would need a couple of triggers to handle this situation,
and to support a single statement doing updates/insert on multiple
rows. The difficulty is to get around the mutating table error.
It would look something like ...
Create or replace package pkg_car as
type pls_tab_car is table of car%rowtype index by binary_integer;
tmp_car pls_tab_car;
nrows binary_integer:=0;
end pkg_car;
/
Create or replace trigger TRG_CAR__BS
before INSERT or UPDATE on CAR
begin
pkg_car.nrows := 0;
end ;
/
Create or replace trigger CAR_BR
before INSERT or UPDATE on CAR
for each row
declare
v_i binary_integer;
begin
pkg_car.NROWS := pkg_car.NROWS + 1;
v_i := pkg_car.NROWS;
pkg_car.TMP_car(v_i).ID := :new.ID; pkg_car.TMP_car(v_i).MAKE := :new.MAKE; pkg_car.TMP_car(v_i).MODEL := :new.MODEL;end ;
Comments anyone (sorry for the formatting, the indentation was striped)? Received on Wed Jan 12 2005 - 13:20:14 CST
![]() |
![]() |