RE: how to make a delete statement fail

From: Goulet, Richard <>
Date: Thu, 27 Aug 2009 09:13:10 -0400
Message-ID: <>


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  

[] On Behalf Of Joe Smith Sent: Wednesday, August 26, 2009 9:21 PM To:
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.
< GL:ON:WL:en-US:SI_SB_online:082009>

Received on Thu Aug 27 2009 - 08:13:10 CDT

Original text of this message