apoc.cypher.runMany
Syntax |
|
||
Description |
Runs each semicolon separated statement and returns a summary of the statement outcomes. |
||
Input arguments |
Name |
Type |
Description |
|
|
The Cypher statements to run, semicolon separated ( |
|
|
|
The parameters for the given Cypher statements. |
|
|
|
|
|
Return arguments |
Name |
Type |
Description |
|
|
The row number of the run Cypher statement. |
|
|
|
The result returned from the Cypher statement. |
Usage Examples
This procedure is useful for executing multiple Cypher statements. We can create a node in one statement and create a relationship to itself in another statement, by running the following query:
CALL apoc.cypher.runMany(
'CREATE (n:Node {name:$name});
MATCH (n {name:$name})
CREATE (n)-[:X {name:$name2}]->(n);',
{name:"John", name2:"Doe"}
);
row | result |
---|---|
-1 |
{constraintsRemoved: 0, indexesRemoved: 0, nodesCreated: 1, rows: 0, propertiesSet: 1, labelsRemoved: 0, relationshipsDeleted: 0, constraintsAdded: 0, nodesDeleted: 0, indexesAdded: 0, labelsAdded: 1, relationshipsCreated: 0, time: 0} |
-1 |
{constraintsRemoved: 0, indexesRemoved: 0, nodesCreated: 0, rows: 0, propertiesSet: 1, labelsRemoved: 0, relationshipsDeleted: 0, constraintsAdded: 0, nodesDeleted: 0, indexesAdded: 0, labelsAdded: 0, relationshipsCreated: 1, time: 0} |
If we don’t want to see statistics for each Cypher statement, we can set statistics: false
:
CALL apoc.cypher.runMany(
'CREATE (n:Node {name:$name});
MATCH (n {name:$name})
CREATE (n)-[:X {name:$name2}]->(n);',
{name:"John", name2:"Doe"},
{statistics: false}
);
row | result |
---|