I have table like this:
CREATE TABLE workingtime_times
(
workingno serial NOT NULL,
checktime character(6) NOT NULL,
timeoffset double precision DEFAULT 9
)
我创建了如下的函数:
CREATE OR REPLACE FUNCTION MyFName()
RETURNS TABLE(
CheckTime character varying,
TimeOffset double
) AS
$BODY$
BEGIN
RETURN QUERY
SELECT t.CheckTime, t.TimeOffset
FROM WorkingTime_Times t
ORDER BY t.WorkingNo DESC
limit 1;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;
ALTER FUNCTION MyFName()
OWNER TO postgres;
出现了如下错误:
类型double不存在
为什么我们可以创建一个列数据类型为double的表格,但在函数中返回失败呢?在这种情况下,我们应该返回什么类型?