WITH T (YYYYMMDD, HHMM) AS
(
VALUES
(20200304, 1046) -- return a timestamp for April 3, 2020, 10:46 AM.
, (20200304, 946) -- return a timestamp for April 3, 2020, 9:46 AM.
, (20200304, 2359) -- return a timestamp for April 3, 2020, 11:59 PM.
, (20200304, 0) -- return a timestamp for April 3, 2020, 0:00 AM.
)
SELECT
YYYYMMDD, HHMM
, TIMESTAMP_FORMAT(DIGITS(DEC(YYYYMMDD, 8)) || DIGITS(DEC(HHMM, 4)), 'YYYYMMDDHH24MI') AS TS
FROM T;
尝试这个:
结果是:
我设法找到了一个蛮力解决方案,但我仍然希望有更好的方法:
另一种可能是