Can someone indicate the proper syntax to determine whether a variable is NULL
or empty and then take appropriate action to set the variable depending on the result.
I currently have a test for NULL
which works fine (part of a MySQL SELECT
statement / stored procedure).
IFNULL(@previousTs, '2017-00-04 00:00:01') ts
I want to include (in the same single line) a test for empty (NULL
or empty both results in @previousTs
being set to 2017-00-04 00:00:01
).
You can try like this:
IF(@previousTs IS NULL or @previousTs= '', '2017-00-04 00:00:01', @previousTs )
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