PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 16, 2022

[FIXED] How to not get this warning? DB2 Warning SQLSTATE=02000 No row was found for FETCH, UPDATE, or DELETE; or the result of a query is an empty table

 July 16, 2022     db2, sql, warnings     No comments   

Issue

The way we have our error handling setup this warning will shoot an email out to everyone when it occurs (I can't change this). I really don't care that no rows were found for this job.

How do I either

A) Check if a row is present before tying to delete it or

B) Circumvent/ignore this warning somehow?

Example of the delete:

 delete from schema.table 
   where key is null;

SQLSTATE=02000 No row error was displayed for FETCH, UPDATE, or DELETE; or the result of a query is an empty table.

I cannot insert a dummy record to delete either.


Solution

Maybe this will do

with delete_rows as (
  select * from old table (delete from schema.table where key is null)
)
select count(*) from delete_rows


Answered By - nfgl
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing