Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

While deleting record it should not allow to delete and also we need to Avoid the oracle errors (ORA-06512:,ORA-04088:)

user-dsg68May 11 2023

While deleting record it should not allow to delete and also we need to avoid the oracle errors which was given after trigger
create or replace TRIGGER trigger_name
BEFORE DELETE ON table_name
for each row
begin
if :old.<column_name> is not null then
RAISE_APPLICATION_ERROR
(-20001,'Records cannot be deleted for <table name> table');
end if;
end;

But, while deleting the records getting below errors, even when we add where condition in delete query as <column_name>

Error information:

ORA-20001: Records cannot be deleted for <table name> table

ORA-06512: at "<trigger_name>", line 2

ORA-04088: error during execution of trigger <trigger_name>

Can you let me know how to resolve this trigger issue. Thanks in advance.

Comments
Post Details
Added on May 11 2023
5 comments
626 views