|| apoc.cypher.runMany - APOC 核心文档 - Neo4j 文档

apoc.cypher.runMany

详情

语法

apoc.cypher.runMany(statement, params [, config ]) :: (row, result)

描述

运行每个以分号分隔的语句,并返回语句执行结果的摘要。

输入参数

名称

类型

描述

statement

STRING

要运行的 Cypher 语句,以分号 (;) 分隔。

params

MAP

给定 Cypher 语句的参数。

config

MAP

{ statistics = true :: BOOLEAN }。默认值为:{}

返回参数

名称

类型

描述

row

INTEGER

运行的 Cypher 语句的行号。

result

MAP

从 Cypher 语句返回的结果。

此存储过程无法执行 SCHEMA 操作。要在 SCHEMA 模式下运行查询,请使用 apoc.cypher.runSchema

使用示例

此存储过程对于执行多个 Cypher 语句很有用。我们可以通过运行以下查询,在一个语句中创建节点,并在另一个语句中创建与自身的关联。

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}

如果我们不想看到每个 Cypher 语句的统计信息,可以将 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
© . This site is unofficial and not affiliated with Neo4j, Inc.