RE: how to make a delete statement fail

  • From: "Goulet, Richard" <Richard.Goulet@xxxxxxxxxxx>
  • To: <joe_dba@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 27 Aug 2009 09:13:10 -0400

create trigger delete_fail
on <table_name>
for each row
  if(DELETING) then raise_application_error(21101,"Cannot delete");
  end if;
Syntax may not be exactly right.

Dick Goulet 
Senior Oracle DBA 
PAREXEL International 



From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Joe Smith
Sent: Wednesday, August 26, 2009 9:21 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: how to make a delete statement fail

How do I make a correct DELETE statement fail?  I have a developer that
wants to test a code branch and he needs a delete statement to fail.


It can't be locked ( shared or exclusive ) from a separate session or be
an incorrect statement or return "0 rows deleted."


It has to be "delete from table where col = value".  How can I force
that to fail?







Windows Live: Keep your friends up to date with what you do online. Find
out more.

Other related posts: