RE: how to make a delete statement fail

Try:
 
create trigger delete_fail
on <table_name>
for each row
begin
  if(DELETING) then raise_application_error(21101,"Cannot delete");
  end if;
end;
 
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?

 

 

 thanks.

 

 


________________________________

Windows Live: Keep your friends up to date with what you do online. Find
out more.
<http://windowslive.com/Campaign/SocialNetworking?ocid=PID23285::T:WLMTA
GL:ON:WL:en-US:SI_SB_online:082009>  

Other related posts: