سؤال

In the docs, I found the function TIMESTAMPADD.

I'm trying to to this:

insert into status(identifier, firstoccurrence) values('foo', 
    timestampadd(SQL_TSI_SECOND, 1389995576, TIMESTAMP '1970-01-01 00:00:00'));

But I got this error:

data exception: interval field overflow / Error Code: -3435 / State: 22015

It seems like there is a problem with the epoch value 1389995576.

The problem is I can't use a bigger time unit, such as day or month, to then divide this constant value because theese are pricise data.

Are there any other ways of doing this?

هل كانت مفيدة؟

المحلول

Try the direct conversion function:

insert into status(identifier, firstoccurrence) values('foo', 
    timestamp(1389995576));

The TIMESTAMPADD function will be extended in future versions to accept large values

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top