1

I want to insert a zero in a record that contains a null value by updating that table. I have used the following code but to no avail.

Statement statementXIV = db.createStatement("UPDATE Temp54 SET bal53 = '0' WHERE balan = NULL ");
                    statementXIV.prepare();
                    statementXIV.execute();       
                    statementXIV.close();

What is the right way to use a null in a WHERE clause?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
techie
  • 467
  • 3
  • 8
  • 23

1 Answers1

1

I would suggest using:

UPDATE Temp54 SET bal53 = '0' WHERE balan IS NULL OR balan = ''

Also, see this link, SQLite select where empty?. The accepted answer gives a variety of methods which is always good to know.

Community
  • 1
  • 1
CM Kanode
  • 1,436
  • 1
  • 11
  • 14