简体   繁体   English

错误:运算符不存在:没有时区的时间戳+整数

[英]ERROR: operator does not exist: timestamp without time zone + integer

i am adding nthmonth (2) in my postgresql function , but at the time of execution it showing error "ERROR: operator does not exist: timestamp without time zone + integer" HINT: No operator matches the given name and argument type(s). 我在我的postgresql函数中添加了nthmonth(2),但是在执行时它显示错误“ ERROR:运算符不存在:没有时区的时间戳+整数”提示:没有运算符匹配给定的名称和参数类型。 You might need to add explicit type casts. 您可能需要添加显式类型转换。 QUERY: SELECT pi_date + nthMonth || 查询:SELECT pi_date + nthMonth || ' month ' :: INTERVAL '月'::间隔

DECLARE
beginMonth  timestamp;
pi_date     timestamp := to_timestamp('14-Jan-2016 01:50 AM,'DD-MON-YYYY HH:MI AM);
> beginMonth := pi_date  +   nthMonth || ' month ' :: INTERVAL;

It's fairly obvious - the "+" is binding more tightly than the "||" 很明显-“ +”的绑定比“ ||”的绑定更紧密 (as it is telling you). (正告诉您)。

You want something like: 您想要类似的东西:

pi_date + (nthMonth || ' months'::interval)

Or, perhaps a little clearer: 或者,也许更清晰一些:

pi_date + (nthMonth * interval '1 month')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:运算符不存在:没有时区的时间戳 > 整数) - ERROR: operator does not exist: timestamp without time zone > integer) 错误:运营商不存在:带时区的时间戳/integer - ERROR: operator does not exist: timestamp with time zone / integer 修复错误:“运算符不存在:没有时区的时间戳>整数”错误 - Fix ERROR: "operator does not exist: timestamp without time zone > integer" error ActiveRecord :: StatementInvalid:PG错误:错误:运算符不存在:没有时区的时间戳> =整数 - ActiveRecord::StatementInvalid: PGError: ERROR: operator does not exist: timestamp without time zone >= integer 运算符不存在:@timestamp without time zone - operator does not exist: @ timestamp without time zone PostgreSQL:运算符不存在:没有时区的时间戳==没有时区的时间戳 - PostgreSQL: operator does not exist: timestamp without time zone == timestamp without time zone PostgreSQL:42883 运算符不存在:没有时区的时间戳 = 文本 - PostgreSQL: 42883 Operator does not exist: timestamp without time zone = text 运算符不存在:没有时区的时间戳~~ *未知的Ruby代码 - operator does not exist: timestamp without time zone ~~* unknown ruby code PostgreSQL:42883运算符不存在:没有时区的时间戳 - PostgreSQL: 42883 Operator does not exist: timestamp without time zone 按日期获取查询 - 错误:运算符不存在:没有时区的时间戳~~未知 - Getting query by date - ERROR: operator does not exist: timestamp without time zone ~~ unknown
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM