I have a Timestamp object-
java.sql.Timestamp time = null;
and I have a datetime
value val_time
in a DB table.
val_time datetime
The situation is, while performaing an operation, this val_time
is not getting updated (which is pretty normal in my case). While reading from DB, naturally the datetime value will be null. So the timestamp object will also be null. My question is - can we get some default value other than null?
since you stated in the tags you use mysql, I would recommend you using IFNULL statement in your query to get a default value instead of NULL then.
SELECT IFNULL(colname, your-default-value) FROM xyz;
http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_ifnull
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