-
Mutating Table - autonomous transaction problem
Hi,
i'm trying to avoid a mutating table issue with an autonomous transaction.
i have to tables:
Table A:
Resnr=Reservation #
Pernr=Personal #
ID RESNR PERNR
----------- ----------- ---------
818 358 5161
819 359 5156
Table B:
RESNR PERNR
----------- ---------
358
359
What i need to do, is to ensure that PERNR 5161 is not allowed to be entered into Table B, Column PERNR by RESNR 358.
Table A is a Reservation Table and i need to guarantee that the person who makes the reservation is a different one, that the one that will be entered into Table B.
I need to have a before - row-level trigger. This trigger produces a mutating Table problem, so i've tried to call a autonomous function. I'm not sure, whether that's the best way.
Here are my attempts:
---------------------------------
Trigger:
create or replace trigger trig_check_pernr
before update of pernr on Table B
for each row
declare
v_funct number;
begin
select func_vier_augen(:new.pernr) into v_funct from dual;
.
.
.
end;
---------------------------------------
Function:
create or replace function func_vier_augen(pernr_in number)
pragma autonomous_transaction;
return number is
c_number number;
c_number1 number;
c_number2 number;
begin
select ausleihe.pernr
into c_number
from reservierung, ausleihe
where (pernr_in = reservierung.pernr
and ausleihe.resnr = reservierung.resnr);
return c_number;
commit;
end;
--------------------------------------
Any ideas?
thanks in advance,
Stefan Hausknecht
Last edited by buck; 02-22-2005 at 06:04 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|