My source table has a Unix timestamp stored in a INT field. I want to convert this using Data services designer to a Datetime format yyyy-mm-dd hh24:mi:ss.
Using the convertion below will end up with errors.
You cannot directly convert an INT data type to a DATE/DATETIME data type. It doesn’t understand what the value in the INT column represents. Is the number the number of seconds past midnight? Number of days since the dawn of time? Get it?
You have to first convert the INT to a VARCHAR. This assumes that your INT column is in a format that lends itself to producing something meaningful as a VARCHAR. For example, I have a system that stores date values as 20120101 in a NUMBER(8) data type. I know the format the number is store as so converting it directly to VARCHAR makes complete sense. In this case the conversion functions would be:
to_date(to_char(sk_dpdate), 'YYYYMMDD')
This works in Oracle just fine. But I don’t believe that DS will accept that so you have to do this:
As Jim says, do explicit conversion. That code will exactly work in 11.7 !
But starting 12.0, DS have enhanced or should say the coding standard on DATE conversions became stringent enough that this glitch won’t work!