Hi
This trigger works fine while insert the data but update the records (start_date) that throws
SQL Error [4091] [42000]: ORA-04091: table grks_trade is mutating, trigger/function may not see itORA-06512: at "TRG_bktrade_BI", line 11
ORA-04088: error during execution of trigger 'TRG_bktrade_BI'
can you help me how to update below condtion throw raise_application_error
if((:NEW.START_DATE >= rec.START_DATE and :NEW.START_DATE <=rec.END_DATE) then
RAISE_APPLICATION_ERROR(-20001,'New record not a valid date');
code :
TRIGGER TRG_bktrade_BI
before INSERT OR UPDATE
ON grks_trade
FOR EACH ROW
begin
IF :NEW.COUNTRY<>'MAA' THEN
RAISE_APPLICATION_ERROR(-20001,'New record should be country is MAA');
END IF;
for rec in (SELECT COUNTRY,GROUP_NUM,START_DATE,END_DATE from grks_trade WHERE GROUP_NUM = :NEW.GROUP_NUM)
loop
if((:NEW.START_DATE >= rec.START_DATE and :NEW.START_DATE <=rec.END_DATE) then
RAISE_APPLICATION_ERROR(-20001,'New record not a valid date');
end if;
end loop;
end;