RE: how to make a delete statement fail
Date: Thu, 27 Aug 2009 09:13:10 -0400
Message-ID: <23C4836D8E9C5F4280A66C0C247BC16F2CF04946_at_US-BOS-MX011.na.pxl.int>
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_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Joe Smith
Sent: Wednesday, August 26, 2009 9:21 PM
To: oracle-l_at_freelists.org
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>
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Aug 27 2009 - 08:13:10 CDT