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;
/
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;
/
Comment