通过dblink插入远程数据库
我正在尝试通过此查询插入远程数据库
当我仅选择这些列时,查询正常工作,但是当我尝试使用30插入时 - 日间隔条件表明语法中的错误 我不知道我在选择30天的数据的间隔语法中做错了什么。 谁能帮我这个! 谢谢
INSERT INTO tc_new_events
SELECT * FROM dblink ('dev_connec','SELECT id,type,eventtime,
deviceid,positionid,geofenceid,
attributes,maintenanceid FROM tc_events
WHERE eventTime < (NOW() - '30 days' INTERVAL )')
AS DATA (id int ,type varchar , eventtime timestamp without time zone ,
deviceid integer,positionid integer,geofenceid integer ,
attributes varchar,maintenanceid integer);
ERROR: syntax error at or near "30"
LINE 13: ...anceid FROM tc_events WHERE eventTime < (NOW() - '30 days' I...
^
SQL state: 42601
Character: 994
I'm trying to insert into remote DB via this query
The query works fine When I only select these columns but when I'm trying to insert with a 30-day interval condition it shows that an error in syntax
I don't know What I'm doing wrong in the interval syntax for selecting data of 30 days.
Can anyone help me with this!
Thanks
INSERT INTO tc_new_events
SELECT * FROM dblink ('dev_connec','SELECT id,type,eventtime,
deviceid,positionid,geofenceid,
attributes,maintenanceid FROM tc_events
WHERE eventTime < (NOW() - '30 days' INTERVAL )')
AS DATA (id int ,type varchar , eventtime timestamp without time zone ,
deviceid integer,positionid integer,geofenceid integer ,
attributes varchar,maintenanceid integer);
ERROR: syntax error at or near "30"
LINE 13: ...anceid FROM tc_events WHERE eventTime < (NOW() - '30 days' I...
^
SQL state: 42601
Character: 994
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论