db2数据库中存的是long长整形数据,查看比较麻烦,现在写一个函数实现long转timestamp
create function num2date
(
v_l DECIMAL(20) --日期 yyyy-MM-dd HH:mm:ss
)
returns timestamp
language sql
begin atomic
return timestamp('1970-01-01 08:00:00') + (v_l/1000) seconds;
end;
create function num2date
(
v_l DECIMAL(20) --日期 yyyy-MM-dd
)
returns date
language sql
begin atomic
return timestamp('1970-01-01 08:00:00') + (v_l/(3600*24*1000)) days;
end;
本文介绍如何在db2数据库中创建函数,将Long数据类型转换为Timestamp,便于更灵活地进行时间数据操作。
5140

被折叠的 条评论
为什么被折叠?



