For example, I want to do the following on a database update.
Is there a constant I can use instead of null
, which won't compile if I use it like:
ContentValues args = new ContentValues(); args.put(KEY_RISK_AMOUNT, null); // what constant do I use instead of null?
Syntax. Following is the basic syntax of using NULL while creating a table. SQLite> CREATE TABLE COMPANY( ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), SALARY REAL ); Here, NOT NULL signifies that the column should always accept an explicit value of the given data type.
ContentValues is a maplike class that matches a value to a String key. It contains multiple overloaded put methods that enforce type safety. Here is a list of the put methods supported by ContentValues: void put(String key, Byte value) void put(String key, Integer value)
SQLite UPDATE Query is used to modify the existing records in a table. You can use WHERE clause with UPDATE query to update selected rows, otherwise all the rows would be updated.
Use ContentValues.putNull(java.lang.String)
:
ContentValues args = new ContentValues(); args.putNull(KEY_RISK_AMOUNT);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With