Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-16-2020 05:48 PM
This code gives an error of below. How to solve it ?
Error:
Neo.ClientError.Statement.SyntaxError
WITH is required between MERGE and LOAD CSV (line 10, column 1 (offset: 295))
"MERGE (p:Person{Name:line.Name})"
^
Code:
LOAD CSV WITH HEADERS
FROM 'file:///GeneralInfo.csv'
AS line
MATCH (c:Cource{CourceName:line.CourceName}),(g:GeneralInfo{Gid:line.Gid})
MERGE (g)-[:BELONG]->(c)
LOAD CSV WITH HEADERS
FROM 'file:///Person.csv'
AS line
MERGE (p:Person{Name:line.Name,Height:line.Height,Weight:line.Weight})
RETURN p,c,g
05-17-2020 08:13 AM
Hi @kuwadat,
Welcome to the community!!
You are trying to run multiple statements at a time.
Either try one at time or check "Enable multi statement query editor" in the Neo4j browser setting and separate them via semi colon as below. Also since they are two statement u cannot return p,c,g in single line
LOAD CSV WITH HEADERS
FROM 'file:///GeneralInfo.csv'
AS line
MATCH (c:Cource{CourceName:line.CourceName}),(g:GeneralInfo{Gid:line.Gid})
MERGE (g)-[:BELONG]->(c)
Return g,c
LOAD CSV WITH HEADERS
FROM 'file:///Person.csv'
AS line
MERGE (p:Person{Name:line.Name,Height:line.Height,Weight:line.Weight})
RETURN p
05-17-2020 05:08 PM
Thank you very much !!
All the sessions of the conference are now available online