人大金仓数据库是不包含unix_timestamp这个函数的
在数据库模式为orcale的情况下,执行下面代码,就能够支持函数了。
CREATE OR REPLACE FUNCTION unix_timestamp(time_val timestamp with time zone)
RETURNS integer
AS
DECLARE
Unix integer;
BEGIN
select extract(epoch from time_val::timestamp at time zone 'PRC' )::integer INTO Unix;
RETURN Unix;
END;
CREATE OR REPLACE FUNCTION unix_timestamp(szstr character varying)
RETURNS integer
AS
DECLARE
Unix integer;
BEGIN
select extract(epoch from szStr::timestamp at time zone 'PRC' )::integer INTO Unix;
RETURN Unix;
END;
CREATE OR REPLACE FUNCTION unix_timestamp()
RETURNS integer
LANGUAGE sql
IMMUTABLE
AS $function$
SELECT (EXTRACT(epoch FROM now()))::integer;
$function$;