O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting a Column to Null

A column can easily be set to null when an SQL statement is used directly to update a table:

UPDATE TESTCURSOR SET RECVAL = NULL WHERE RECNO = 1;

It's different when a prepared statement is used to update records because the value will be a parameter marker:

UPDATE TESTCURSOR SET RECVAL = ? WHERE CURRENT OF cursorname;

A null pointer does not have the same meaning in SQL as it might in Java. To set a value to null, the setNull() or updateNull() methods must be used. The updateNull() method is used with result sets and is the simpler of the two methods because it only needs the index of the column. The setNull() method requires the parameter marker number and the data type of the value that the null value is supposed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required