【发布时间】:2021-07-13 14:19:49
【问题描述】:
我已经创建了postgres程序,我这里没有写整个程序,只是写出错误的部分,如下所示,
create or replace procedure xyz() as $$
declare
v_time timestamp without time zone;
v_retain_days int;
Begin
select retain_days from abc into v_retain_days;
v_time := cast('select CURRENT_TIMESTAMP - INTERVAL ''' || v_retain_days || ' day''' as timestamp) ;
END;
使用此过程调用,其报错如下:
错误:时间戳类型的输入语法无效:“select CURRENT_TIMESTAMP - INTERVAL '7 day'”
有人可以帮忙吗?
【问题讨论】:
标签: postgresql procedure