Trigger giving exception ORA-04091

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hemantmudaliar
    New Member
    • Jul 2007
    • 2

    Trigger giving exception ORA-04091

    The Trigger is giving following exception

    java.sql.SQLExc eption: ORA-04091: table PSCONTENT.VGNAS CHANNEL is mutating, trigger/function may not see it ORA-06512: at "PSCONTENT.CHEC K_CHANNEL_UNPUB LISH", line 4 ORA-06512: at "PSCONTENT.CHEC K_CHANNEL_UNPUB LISH_TR", line 1 ORA-04088: error during execution of trigger ............... ............... ..

    // Trigger
    CREATE OR REPLACE TRIGGER check_channel_u npublish_tr
    before delete
    ON vgnaschannel
    for each row
    check_channel_u npublish( :old.id )
    ;
    /



    // Procedure
    CREATE OR REPLACE procedure check_channel_u npublish( p_channelId in char ) as
    n int;
    begin
    select count(*) into n
    from vgnAsChannel
    where parentChannelId = p_channelId;
    if ( n > 0 ) then
    raise_applicati on_error(
    num => -20052,
    msg => ( 'attempt to unpublish channel that is referenced by still-published subchannels; id=' || p_channelId ) );
    end if;
    select count(*) into n
    from vgnAsChannelFil eAssociation
    where channelId = p_channelId;
    if ( n > 0 ) then
    raise_applicati on_error(
    num => -20053,
    msg => ( 'attempt to unpublish channel that has ' || n || ' still-published objects associated with it' ) );
    end if;
    end;
    /
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Your case is a mutating trigger error.

    this happens when the trigger tries to modify the base table from which it is reading data.

    Comment

    • hemantmudaliar
      New Member
      • Jul 2007
      • 2

      #3
      Originally posted by debasisdas
      Your case is a mutating trigger error.

      this happens when the trigger tries to modify the base table from which it is reading data.

      Thanks for the reply.

      But my problem is that, I cannot modify the Trigger neither can i disable it as this trigger is written in a CMS tool which i m using.

      Is there any way of achieving the same functionality by writting any DB query/ procedure etc.

      Hemant

      Comment

      Working...