# DELETE and CREATE in one statement

**URL:** <https://community.neo4j.com/t/delete-and-create-in-one-statement/30191>\
**Category:** General\
**Tags:** apoc, cypher\
**Created:** [December 7, 2020, 7:27pm UTC](https://community.neo4j.com/t/delete-and-create-in-one-statement/30191 "2020-12-07T19:27:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrankR85](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/frankr85/32/13519_2.png) [@FrankR85](https://community.neo4j.com/u/FrankR85)\
**Post date:** [December 7, 2020, 7:27pm UTC](https://community.neo4j.com/t/delete-and-create-in-one-statement/30191/1 "2020-12-07T19:27:43Z")

</div>

Before we create a new customer we want to be sure to delete all possibly existing direct relationships.  
How can we do that?

```auto
unwind $customers as customer
CALL apoc.cypher.runMany(
  'match (c:Customer {id: $myCustomer.id})-[]->(n) detach delete n;
   merge (c:Customer {id: $myCustomer.id})
    set c = $myCustomer',
  {myCustomer: customer})

```

Gives an error: **Query cannot conclude with CALL (must be RETURN or an update clause)**

Is there a way to first delete all direct neighbors and then merge on the customer without apoc.cypher.runMany?

---

<div class="post-metadata">

**Author:** ![terryfranklin82](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/terryfranklin82/32/5233_2.png) [@terryfranklin82](https://community.neo4j.com/u/terryfranklin82)\
**Post date:** [December 7, 2020, 10:06pm UTC](https://community.neo4j.com/t/delete-and-create-in-one-statement/30191/2 "2020-12-07T22:06:24Z")

</div>

Have you tried adding something like:

```auto
yield result
return result

```

to the end of the query?
