How to define constants in cypher

I want to define constant values in a cypher query and use it multiple times inside different statements. Is that possible ? How can I do that ?

I think I just find it. WITH statement can be used for such purpose

WITH round(rand()*10000000) as d1

MATCH ()-[e]-()
WHERE NOT EXISTS(e['start_time'])
SET e.start_time = d1
return e
limit 1 
1 Like

You've got it.

Let me frame it differently for you -- Cypher doesn't really do variable assignment, so just about everything is a constant in cypher, in that you can't mutate variables, unless you alias them under other names.