Hi,
For some reason when I execute a Cypher query containing character '{' I get an error.
Here is an example of a query I found in the official documentation (link):
UNWIND [0, 1, 2] AS x
CALL {
WITH x
RETURN max(x) AS xMax
}
RETURN x, xMax
Which throws the following error: Invalid input '{': expected whitespace, comment, namespace of a procedure or a procedure name
I tried executing the query in the neo4j browser and also by sending the query with the official neo4j driver for java, and in both situation the error is identical.
It seems I always get an error when using the '{' character in a query, except when I use it to define a node or edge body.
I am using neo4j server community edition version 3.5.14
Why do I get this error? Is '{' a meta character that is never found as is in a Cypher query?
Please let me know what exactly are you trying to achieve?
You cannot use call for such statement and multiple return statement is also not correct. RETURN can only be used at the end of the query.
Thank you for the fast reply.
I am simply trying some queries to train myself for the moment. I found the query in neo4j documentation (there), and I was curious to know what I was doing wrong.
How should one use call with an inline procedure?
This syntax looked a little odd to me, but it's definitely in the documentation. The documentation you linked to is for neo4j version 4. Version 4 has a number of new features, and it looks like this is one of them (that page does not exist for version 3.5 of the documentation).
So, I think if you use neo4j version 4.0 you'll have success with that example.
Hopefully that solves your issue. Welcome again!
-Mike