Skip to Content
0
Former Member
Jul 29, 2016 at 01:54 PM

Date zeros showing up as nulls

957 Views

While working with HANA Studio

I recently noticed that a zero or empty string value appears to be null when converted to a date.

In the result it looks exactly like a null value, but it definitely is and behaves as a normal (NOT NULL) value.

Although it is quite obvious to me now in a simple set up, it did really trow me off.

Does anybody know how prevent zero dates from appearing as null values ?

I know explicitly converting to CHAR would do the job, but I would like to keep the date datatype.

Thanks, Scott

The SQL below shows what I mean.

select distinct * from (

SELECT TO_DATE(NULL) as DATE_COL FROM DUMMY -- a real null value

UNION

SELECT TO_DATE(0) as DATE_COL FROM DUMMY -- looks like null in the result

);

Attachments

DATE_NULLS.PNG (8.6 kB)