Param Sytax error

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.

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.

1 Like

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.