【发布时间】:2017-05-31 04:49:07
【问题描述】:
我在使用此功能时遇到问题,不知道如何解决。
Create Function Quy(sdate timestamp)
returns integer as $$
declare
numbmonth integer;
quy integer;
Begin
numbmonth := Date_part('month',sdate);
If numbmonth < 4 then
quy := 1;
else if numbmonth < 7 then
quy := 2;
else if numbmonth < 10 then
quy := 3;
else quy := 4;
return quy;
END;
$$
LANGUAGE plpgsql;
当我尝试运行代码时会发生这种情况:
ERROR: syntax error at or near ";" LINE 16: END;
我真的不明白这有什么问题。
【问题讨论】:
-
尝试删除 ; END 之后?
标签: postgresql function if-statement plpgsql