Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    5

    Unanswered: error:'trigger/function may not see it'

    Hi. I am a new oracle user and I have got this errors while calling this statement:

    update MALZEME set STOK=9 where MAL_ID=1

    ORA-04091: table SYSTEM.MALZEME is mutating, trigger/function may not see it
    ORA-06512: at "SYSTEM.STKCTRL", line 4
    ORA-04088: error during execution of trigger 'SYSTEM.STKCTRL'

    my table:
    create table MALZEME(
    MAL_ID number(4),
    ADI varchar2(15),
    STOK number(6),
    BIRIM varchar2(6),
    CONSTRAINT pk_malzeme PRIMARY KEY (MAL_ID));

    And my trigger:

    create or replace trigger STKCTRL after update of STOK on MALZEME for each row
    declare
    stk MALZEME.STOK%TYPE;
    begin
    select STOK into stk from MALZEME where MAL_ID=1;
    if (stk<10) then
    raise_application_error(-20000,'Glikolik Asit stogumuz 10 litrenin altina d&#252;st&#252;');
    end if;
    end;

    Thanks for your helps.
    (Sorry for my english)

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    In this case, just removing the FOR EACH ROW part of the trigger definition would fix it. Row-level triggers can't access the same table that they were fired on. See this article by Tom Kyte.

  3. #3
    Join Date
    May 2008
    Posts
    5

    Thank you very much!!!

    it is working now. i thought 1 hour but i couldn't see 'for each row' thanks a lot again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •