CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Other Databases (http://www.codingforums.com/forumdisplay.php?f=38)
-   -   Oracle 10g - delete record that doesn't exist (http://www.codingforums.com/showthread.php?t=286676)

WolfShade 01-29-2013 08:43 PM

Oracle 10g - delete record that doesn't exist
 
Hello, everyone.

In Oracle 10g, if an attempt is made to delete a record from the database that doesn't exist, will it throw an error?

Old Pedant 01-29-2013 10:09 PM

If it throws an error, then it's not conformant with ANSI SQL, at all.

ANSI says a DELETE that affects zero records is never an error.

I would be truly surprised if Oracle went against ANSI on something this fundamental.

*********

If you are only looking to see how many records were deleted, most DB interfaces will give you that information.

Old Pedant 01-29-2013 10:11 PM

Quote:

delete a record from the database that doesn't exist
Ummm...I'm assuming you meant that to read
Code:

delete a non-existent record from an existing database
If the database itself doesn't exist, yes, you will get an error.

WolfShade 01-30-2013 01:48 PM

Quote:

Originally Posted by Old Pedant (Post 1309591)
If it throws an error, then it's not conformant with ANSI SQL, at all.

ANSI says a DELETE that affects zero records is never an error.

I would be truly surprised if Oracle went against ANSI on something this fundamental.

*********

If you are only looking to see how many records were deleted, most DB interfaces will give you that information.

Thanks, Pedant. I didn't think it would, but I've got a weird error when trying to delete a record. Trying to track down what is causing it, and thought that _maybe_ Oracle was erroring if the record did not exist.

Old Pedant 01-30-2013 08:58 PM

Oracle does allow you to DELETE from views, but then it puts restrictions on that (which I think you'd need to be an Oracle guru to understand...some are really weird!).

Is it possible that is what is happening here? That you think you are deleting from a table but it's really from a VIEW of a table?

WolfShade 01-30-2013 09:15 PM

I don't know about VIEW, but I do know that whenever there's that kind of an issue, it's usually with SYNONYMS, not VIEWS.


All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.