You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cypher查询报错:Invalid input 's': expected 'n/N' 如何修复?

Cypher查询语法错误修复方案

原错误查询语句

match (n:attribAct) where not tolower(n.Aliases) contains tolower(n.name) set n.Aliases = n.name+","+n.Aliases as x return x;

报错信息

Invalid input 's': expected 'n/N' (line 1, column 115 (offset: 114))
"match (n:attribAct) where not tolower(n.Aliases) contains tolower(n.name) set n.Aliases = n.name+","+n.Aliases as x return x;"

问题原因

Cypher语法中,SET子句仅用于更新节点或关系属性,不允许在赋值表达式后使用as指定别名。别名定义只能放在RETURN或WITH这类数据投影子句中。

修复后的查询语句

MATCH (n:attribAct) 
WHERE NOT tolower(n.Aliases) CONTAINS tolower(n.name) 
SET n.Aliases = n.name + "," + n.Aliases 
RETURN n.Aliases AS x;

内容的提问来源于stack exchange,提问作者Tono Kuriakose

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 04:44:54