Re: how to make a delete statement fail
From: Daniel Fink <daniel.fink_at_optimaldba.com>
Date: Wed, 26 Aug 2009 19:41:42 -0600
Message-ID: <4A95E456.9010600_at_optimaldba.com>
When you mean 'incorrect statement' do you mean that it won't parse? Such as "delete form table..."?
ERROR at line 1:
ORA-01722: invalid number
Date: Wed, 26 Aug 2009 19:41:42 -0600
Message-ID: <4A95E456.9010600_at_optimaldba.com>
When you mean 'incorrect statement' do you mean that it won't parse? Such as "delete form table..."?
If you are wanting a run time error, how about using TO_NUMBER() on a character column?
SQL> delete from employees where to_number(ename) = 9; delete from employees where to_number(ename) = 9
*
ERROR at line 1:
ORA-01722: invalid number
Regards,
Daniel Fink
-- Daniel Fink Help me support The Children's Hospital of Denver one of the 10 best pediatric hospitals in the US! I'm riding in the 2009 Courage Classic - 157 miles in 3 days Visit my Personal Rider Page http://www.couragetours.com/2009/danielwfink to donate. OptimalDBA http://www.optimaldba.com Oracle Blog http://optimaldba.blogspot.com Lost Data? http://www.ora600.be/ Joe Smith wrote:Received on Wed Aug 26 2009 - 20:41:42 CDT
>
> 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:WLMTAGL:ON:WL:en-US:SI_SB_online:082009>
-- http://www.freelists.org/webpage/oracle-l