<p>So, I have 2 database instances, one is for development in general, another was copied from development for unit tests.</p>

<p>Something changed in the development database that I can't figure out, and I don't know how to see what is different.</p>

<p>When I try to delete from a particular table, with for example:</p>

<pre><code>delete from myschema.mytable where id = 555
</code></pre>

<p>I get the following normal response from the unit test DB indicating no row was deleted:</p>

<blockquote>
  <p>SQL0100W  No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.  SQLSTATE=02000</p>
</blockquote>

<p>However, the development database fails to delete at all with the following error:</p>

<blockquote>
  <p>DB21034E  The command was processed as an SQL statement because it was not a valid Command Line Processor command.  During SQL processing it returned: SQL0440N  No authorized routine named "=" of type "FUNCTION" having compatible arguments was found.  SQLSTATE=42884</p>
</blockquote>

<p>My best guess is there is some trigger or view that was added or changed that is causing the problem, but I have no idea how to go about finding the problem... has anyone had this problem or know how to figure out what the root of the problem is?</p>

<p>(note that this is a DB2 database)</p>

[{'answer_id': 53000, 'author': 'w4ik', 'author_id': 4232, 'author_profile': 'https://Stackoverflow.com/users/4232', 'pm_score': 0, 'selected': False, 'text': '<p>You might have an open transaction on the dev db...that gets me sometimes on SQL Server</p>\n'}, {'answer_id': 53015, 'author': 'Leigh Caldwell', 'author_id': 3267, 'author_profile': 'https://Stackoverflow.com/users/3267', 'pm_score': 0, 'selected': False, 'text': '<p>Is the type of id compatible with 555? Or has it been changed to a non-integer type?</p>\n\n<p>Alternatively, does the 555 argument somehow go missing (e.g. if you are using JDBC and the prepared statement did not get its arguments set before executing the query)?</p>\n'}, {'answer_id': 53169, 'author': 'castaway', 'author_id': 4840, 'author_profile': 'https://Stackoverflow.com/users/4840', 'pm_score': 0, 'selected': False, 'text': '<p>Can you add more to your question? That error sounds like the sql statement parser is very confused about your statement. Can you do a select on that table for the row where id = 555 ? </p>\n\n<p>You could try running a RUNSTATS and  REORG TABLE  on that table, those are supposed to sort out wonky tables.</p>\n'}, {'answer_id': 53192, 'author': 'Mike Stone', 'author_id': 122, 'author_profile': 'https://Stackoverflow.com/users/122', 'pm_score': 0, 'selected': False, 'text': '<p><a href="https://stackoverflow.com/questions/52981/cannot-delete-from-the-database#53169">@castaway</a></p>\n\n<p>A select with the same "where" condition works just fine, just not delete.  Neither runstats nor reorg table have any affect on the problem.</p>\n'}, {'answer_id': 53231, 'author': 'castaway', 'author_id': 4840, 'author_profile': 'https://Stackoverflow.com/users/4840', 'pm_score': 2, 'selected': True, 'text': '<p>Hmm, applying the great oracle to this question, I came up with:</p>\n\n<p><a href="http://bytes.com/forum/thread830774.html" rel="nofollow noreferrer">http://bytes.com/forum/thread830774.html</a></p>\n\n<p>It seems to suggest that another table has a foreign key pointing at the problematic one, when that FK on the other table is dropped, the delete should work again. (Presumably you can re-create the foreign key as well)</p>\n\n<p>Does that help any?</p>\n'}, {'answer_id': 53241, 'author': 'Mike Stone', 'author_id': 122, 'author_profile': 'https://Stackoverflow.com/users/122', 'pm_score': 0, 'selected': False, 'text': '<p><a href="https://stackoverflow.com/questions/52981/cannot-delete-from-the-database#53231">@castaway</a></p>\n\n<p>We actually just solved the problem, and indeed it is just what you said (a coworker found that exact same page too).</p>\n\n<p>The solution was to drop foreign key constraints and re-add them.</p>\n\n<p>Another post on the subject:</p>\n\n<p><a href="http://www.ibm.com/developerworks/forums/thread.jspa?threadID=208277&amp;tstart=-1" rel="nofollow noreferrer">http://www.ibm.com/developerworks/forums/thread.jspa?threadID=208277&amp;tstart=-1</a></p>\n\n<p>Which indicates that the problem is a referential constraint corruption, and is actually, or supposedly anyways, fixed in a later version of db2 V9 (which we are not yet using).</p>\n\n<p>Thanks for the help!</p>\n'}, {'answer_id': 163347, 'author': 'Fuangwith S.', 'author_id': 24550, 'author_profile': 'https://Stackoverflow.com/users/24550', 'pm_score': 0, 'selected': False, 'text': '<p>Please check \n1. your arguments of triggers, procedure, functions and etc.\n2. datatype of arguments.</p>\n'}]
['https://Stackoverflow.com/questions/52981', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/122/']