Hi, I am trying to create my first function in Teradata SQL Assistant using a script I found on the internet. the purpose of the function is to convert a timestamp to a unix timestamp and is as follows;
CREATE OR REPLACE FUNCTION oracle_to_unix(in_date IN DATE) RETURN NUMBER
RETURN (in_date -TO_DATE('19700101','yyyymmdd'))*86400 - TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))*3600; END;
when I try to run this sql I get the error "Data Type "in_data" does not mata Defined Data type.
This is Oracle source code, of course it's not working as-is on Teradata.
See http://forums.teradata.com/forum/general/convert-13-digit-epoch-time-to-date#comment-148179 for an example to cast a Timestamp to epoch time.