I am trying to set a null value for a property when I create a node.
I tried something like this:
CREATE(p:Person {p_id: TOINT(line.`id`) })
SET p.initials = null
But that gives me Neo.ClientError.Statement.SyntaxError
.
How can I set a null value with CQL in Neo4j?
I don't think that you error comes from setting a property to null, but on the TOINT function. Cypher is case-sensitive, and the correct syntax is toInt. So your query should looks like this :
CREATE(p:Person {p_id: toInt(line.`id`) })
SET p.initials = null
Moreover, Neo4j doesn't store null
value. A null
value, is a property that doesn't exist.
In Neo4j you can't set null to property that way. But to get the same result you can remove the property for the given node. You can learn more about removing properties in neo4j docs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.