CREATE OR REPLACE function maxTime(arr timestamp[])
returns timestamp as
$BODY$
declare x timestamp;
declare min timestamp;
begin
if arr is null then
return null;
end if;
if array_length(arr,1) is null then
return null;
end if;
max := '1970-01-01 08:00:00';
FOR x in array_lower(arr, 1) .. array_upper(arr, 1)
loop
if arr[x]>max then
max := arr[x];
end if ;
end loop ;
return max ;
end;
$BODY$
language plpgsql;
在greenplum中自定义获取时间数组字段最大值函数。(亲测可用)
最新推荐文章于 2021-03-11 23:16:00 发布