cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Param Sytax error

tideon
Graph Buddy

Dear Everyone,

I literally copy paste the following from the help file and got a syntax error. Am I missing something?


:param name => 'Stella'
MATCH (n:Person) WHERE n.name = $name
return t

Here is the error message

Syntax error at line 2 col 0:

  MATCH (n:Person) WHERE n.name = $name
  ^
Unexpected "\n".

I am attempting to understand parameters and why they are necessary or when to use them.

3 REPLIES 3

akaur
Node Link

Hi @tideon ,

You need to set the parameter(name to 'Stella') first by running it separately:
:param name => 'Stella'

And now use the parameter in Cypher query-
MATCH (n:Person) WHERE n.name = $name
return n

Using parameters, rather than hard coding values, will allow for reuse of the query plan cache.

And is the param in the background untime you restart the database? The information in the manual isn't clear about what it entails.

Also thank you Akaur for the answer.

The manual doesn't mention these types of little details.