Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help - Database Trigger
--0-1649760492-958602812=:9977
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
see attached file.
Hope it helps.
--- salu Ullah <salu_ullah_at_hotmail.com> wrote:
> Hello,
>
> Iam trying to create a database trigger that should
> fire & delete a row
> after all the columns are made null except the
> foreign key which is also a
> primary key of that table.
> I have a table that has rate_cd column as a primary
> key & five more column
> as(rate_alt1, rate_alt2.... rate_alt5)
> Now, if i make all the alternate rates null, it
> should delete the row
> completely.
> I have tried & created an after insert or upate
> trigger but its giving me
> mutating error
> because its quering its own triggering table.
> Any workaround for the mutating table error??
>
> Thanks in advance
>
> Salu
>
>
>
Content-Type: text/plain; name="trigger_plsql_package.txt" Content-Description: trigger_plsql_package.txt Content-Disposition: inline; filename="trigger_plsql_package.txt"
create or replace package plstab as
TYPE saltab is table of emp.sal%type INDEX BY BINARY_INTEGER;
TYPE mgrtab is table of emp.mgr%type INDEX BY BINARY_INTEGER;
v_saltab saltab;
v_mgrtab mgrtab;
no_of_rows number :=0;
end plstab;
/
create or replace trigger emp_update_before before update of sal on emp for each row
begin
plstab.no_of_rows :=plstab.no_of_rows + 1; plstab.v_saltab(plstab.no_of_rows) :=:new.sal; plstab.v_mgrtab(plstab.no_of_rows) :=:new.mgr;end;
![]() |
![]() |