I am having a table bugs_metadata like create table bugs_metadata(REPORT_NAME varchar2(10), WHERE_CLAUSE varchar2(100)); insert into bugs_metadata('test','29603754,29605708,29649865'); I am getting "mutating, trigger/function may not see it" error in below trigger on update of WHERE_CLAUSE column in above table:
create or replace TRIGGER "c_b_c_b_update" AFTER
UPDATE ON bugs_metadata
FOR EACH ROW
BEGIN
CASE
WHEN UPDATING('WHERE_CLAUSE') THEN
IF :NEW.WHERE_CLAUSE is not null THEN
insert into bug_data(BUG_NUMBER,SUBJECT)
select rptno,SUBJECT
from rpthead
where rptno in (select regexp_substr(:NEW.WHERE_CLAUSE,'[^,]+',1,level) WHERE_CLAUSE
from bugs_metadata t2
connect by regexp_substr(:NEW.WHERE_CLAUSE,'[^,]+',1,level) is not null )
and rptno not in(select bug_number from bug_data);
END IF;
END CASE;
END;
Could you please let me know what is wrong here?
bugs_metadatatable and also uses that tableINSERT INOT bug_data ... SELECT ... WHERE ... bugs_metadata. - Lukasz Szozdabugs_metadatatable on which your're trying to construct a trigger. You can replacebugs_metadatawithdual. So, consider @Littlefoot 's answer. - Barbaros Özhan